如何隐藏 UITextField 边框? [英] How to hide UITextField border?
问题描述
我有一个 UITextField,我正在尝试使 UITextField 边框不可见,以便背景和 UITextField 具有相同的颜色并且会有无缝的外观.但问题是我也使用了占位符,并且有一个无法删除的边框.我已经试过了:
I have a UITextField and I am trying to make the UITextField border invisible so that the background and UITextField would have the same color and there would be a seamless look. But the problem is I also use a placeholder and there is a border that I cannot remove. I already tried:
textOption.borderStyle = UITextBorderStyleNone;
textOption.layer.borderWidth = 0;
没有用.你能帮我解决这个问题吗?我仍然可以看到 UITextField 的边框.仅供参考:我使用的 UITextView 没有这个问题 => UITextViews 中没有占位符.
It didn't work. Would you please help me on that? I still can see the border of the UITextField. fyi: The UITextView that I use doesn't have this issue => There is no placeholder in UITextViews.
推荐答案
如果你想去掉文本框的边框,你可以直接用interface builder来做:
If you want to remove the textfield border you can do it directly with interface builder:
这篇关于如何隐藏 UITextField 边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!