Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在自定义uiview中删除边框线?_Ios_Swift_Xcode_Swift2 - Fatal编程技术网

Ios 如何在自定义uiview中删除边框线?

Ios 如何在自定义uiview中删除边框线?,ios,swift,xcode,swift2,Ios,Swift,Xcode,Swift2,我创建了一个自定义视图,并在UINavigationController中调用它,我使其透明,但在我将其放入导航控制器后,我得到了该边框,如何删除它? 提前感谢您需要将视图的边框颜色设置为透明 yourview.layer.borderColor = UIColor.clearColor() 这应该可以。您需要将视图的边框颜色设置为透明 yourview.layer.borderColor = UIColor.clearColor() 这应该是可行的。试试这段代码。(91158236)是导航

我创建了一个自定义视图,并在UINavigationController中调用它,我使其透明,但在我将其放入导航控制器后,我得到了该边框,如何删除它?
提前感谢

您需要将视图的边框颜色设置为透明

yourview.layer.borderColor = UIColor.clearColor()

这应该可以。您需要将视图的边框颜色设置为透明

yourview.layer.borderColor = UIColor.clearColor()
这应该是可行的。

试试这段代码。(91158236)是导航栏的颜色

yourview.layer.borderColor = UIColor(red: 91.0 / 255, green: 158.0 / 255, blue: 236.0 / 255, alpha: 1.0).CGColor
对于borderWidth为4.0的导航栏中包含的红色视图,将产生如下结果

希望这有帮助

试试这段代码。(91158236)是导航栏的颜色

yourview.layer.borderColor = UIColor(red: 91.0 / 255, green: 158.0 / 255, blue: 236.0 / 255, alpha: 1.0).CGColor
对于borderWidth为4.0的导航栏中包含的红色视图,将产生如下结果


希望这有帮助

尝试使用0设置视图的边框宽度

yourView.layer.borderWidth = 0

尝试使用0设置视图的边框宽度

yourView.layer.borderWidth = 0

在Swift 3+上更新

yourview.layer.borderColor = UIColor.clear.cgColor

在Swift 3+上更新

yourview.layer.borderColor = UIColor.clear.cgColor

请提供一些自定义视图实现的代码您可以通过设置边框颜色来尝试吗?
customView.layer.borderColor=UIColor.clearColor()
我设置了边框颜色,但仍然是相同的请提供一些自定义视图实现的代码您可以尝试设置边框颜色吗?
customView.layer.borderColor=UIColor.clearColor()
我设置了边框颜色,但答案仍然是相同的,但仍然是相同的@SandroHum,您可以尝试在视图的顶部和底部添加一个像素吗?您确定这是显示边框的视图吗?尝试使用验证添加边框的视图。该代码应该删除边框。谢谢你的回答,但它仍然是相同的@SandroHum,你能尝试在视图的顶部和底部添加一个像素吗?您确定这是显示边框的视图吗?尝试使用验证添加边框的视图。该代码应该删除边框。