gpt4 book ai didi

swift - 曲线搜索栏 Swift 4

转载 作者:搜寻专家 更新时间:2023-11-01 06:01:00 24 4
gpt4 key购买 nike

<分区>

我在导航 Controller 上以编程方式更改我的搜索栏设计时遇到了问题。我只想使搜索栏曲线如下图所示:

enter image description here

我在堆栈溢出中尝试了很多例子,但我仍然无法改变形状。这是现在的样子:

enter image description here

这里是源代码,关于已经完成的工作:

//MARK for searchBar UI
searchController.dimsBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.placeholder = " Search for programs..."
searchController.searchBar.sizeToFit()
searchController.searchBar.isTranslucent = false
searchController.searchBar.backgroundImage = UIImage()
searchController.searchBar.delegate = self
navigationItem.titleView = searchController.searchBar
self.searchController.searchBar.layer.cornerRadius = 20.0
self.searchController.searchBar.clipsToBounds = true
// SearchBar text
let textFieldInsideUISearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField
textFieldInsideUISearchBar?.borderStyle = .roundedRect
textFieldInsideUISearchBar?.font = textFieldInsideUISearchBar?.font?.withSize(14)

现在,我真的不知道如何更改它,在此先感谢。

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