繁体   English   中英

Swift:如何在tableViewController中以编程方式更改tableHeaderView的边框颜色

[英]Swift: How to change tableHeaderView's border color programatically in a tableViewController

我尝试将headerView的边框颜色更改为绿色,但是似乎我的代码不起作用。 我试过的是:

tableView.tableHeaderView?.layer.borderColor = UIColor(red: 105.0/255.0, green: 215.0/255.0, blue: 189.0/255.0, alpha: 1.0).CGColor
tableView.tableHeaderView?.layer.masksToBounds = true

但是,标题的边框仍然如下所示:

这是图片 (对不起,我没有足够的声誉来发布图片)

如您所见,边框仍然是黑色/深蓝色。

任何帮助将不胜感激! 提前致谢!

我认为导航栏和搜索栏之间的边框有问题...

检查此链接以获取解决方案

searchBar.backgroundImage = UIImage()

更改边框的一些示例:

searchBar.layer.borderWidth = 1 
searchBar.layer.borderColor = someColor.CGColor

暂无
暂无

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

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