简体   繁体   English

如何在导航栏中删除 UITextField 的边框

[英]How to remove border of UITextField in navigationbar

I want to remove UItextField Border which is in navigationbar.我想删除导航栏中的 UItextField 边框。 I've gone through this link, but it is not working.我已经浏览了这个链接,但它不起作用。 (I made a sample app and added UItextField on ViewConroller so it is working fine) (我制作了一个示例应用程序并在 ViewConroller 上添加了 UItextField 所以它工作正常)

How to hide UITextField border? 如何隐藏 UITextField 边框?

Cannot remove border of UITextField dynamically 无法动态删除 UITextField 的边框

Do you want to remove the border of UITextView or UITextField?是否要去除 UITextView 或 UITextField 的边框? If you want to remove it in a textField just try this:如果你想在 textField 中删除它,试试这个:

textField.borderStyle = UITextBorderStyleNone;

Try this:尝试这个:

    textField = subview as! UITextField
    textField.borderStyle = .None
    textField.layer.borderWidth = 1
    textField.layer.borderColor = UIColor.lightGrayColor().CGColor
    textField.layer.cornerRadius = 14
    textField.background = nil;
    textField.backgroundColor = UIColor.whiteColor()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM