xcode 如何在自定义uiview中删除边框线?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41222351/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to remove border line in custom uiview?
提问by Saeed
回答by Hosny
Try to set border width of your view with 0
尝试将视图的边框宽度设置为 0
yourView.layer.borderWidth = 0
回答by Sandro Machado
You need to set the border color of your view transparent.
您需要将视图的边框颜色设置为透明。
yourview.layer.borderColor = UIColor.clearColor()
This should work.
这应该有效。
回答by Md. Ibrahim Hassan
Try this code out. (91,158,236) is the color of your navigation bar.
试试这个代码。(91,158,236) 是导航栏的颜色。
yourview.layer.borderColor = UIColor(red: 91.0 / 255, green: 158.0 / 255, blue: 236.0 / 255, alpha: 1.0).CGColor
For a red View contained in navigation Bar for a borderWidth of 4.0 it would produce result like
对于包含在导航栏中的红色视图,边框宽度为 4.0,它会产生类似的结果
Hope this helps.
希望这可以帮助。
回答by Tuan Huynh
Update on Swift 3+
Swift 3+ 更新
yourview.layer.borderColor = UIColor.clear.cgColor