gpt4 book ai didi

UINavigationController 和 UISearchBar 之间的 iOS 9 细线

转载 作者:行者123 更新时间:2023-11-29 01:18:40 26 4
gpt4 key购买 nike

我有一个 UINavigationController,在其下以编程方式放置了一个 UISearchController

searchController.searchBar.barTintColor = UIColor(red: 242/255.0, green: 82/255.0, blue: 46/255.0, alpha: 0.4)
searchController.searchBar.translucent = false
searchController.searchBar.layer.borderColor = UIColor.whiteColor().CGColor
searchController.searchBar.layer.borderWidth = 0

我像上面那样设置了我的 UISearchController。我将 UINavigationBar 设置为全局设计,如下所示:

UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().barTintColor = UIColor(red: 242/255.0, green: 82/255.0, blue: 46/255.0, alpha: 1.0)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarPosition: .Any, barMetrics: .Default)
UINavigationBar.appearance().layer.shadowRadius = 0
UINavigationBar.appearance().layer.shadowOpacity = 0
UINavigationBar.appearance().layer.shadowOffset = CGSizeMake(0,0)
UINavigationBar.appearance().titleTextAttributes = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: UIFont(name: "JosefinSans-SemiBold", size: 18)!
]

它应该移除 1px 细线边框,但它没有。我读到这是因为阴影图像,但我似乎无法删除 1px 细线。谁能帮帮我?

最佳答案

尝试替换这个:

searchController.searchBar.layer.borderColor = UIColor.whiteColor().CGColor
searchController.searchBar.layer.borderWidth = 0

用这个:

searchController.searchBar.layer.borderColor = UIColor(red: 242/255.0, green: 82/255.0, blue: 46/255.0, alpha: 1).CGColor
searchController.searchBar.layer.borderWidth = 1

关于UINavigationController 和 UISearchBar 之间的 iOS 9 细线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34858439/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com