ios - 选择文本字段时 UISearchBar 会更改背景

标签 ios swift uisearchbar

我希望UISearchBar的背景为黑色,但是当选择文本字段时,它向上滑动并将背景更改为灰色:

默认:

enter image description here

--

选择后:

enter image description here

最佳答案

如果你想在UISearchBar的背景中设置黑色,那么尝试一下..

UISearchBar *searchbar=[[UISearchBar alloc]init];
searchbar.barTintColor = [UIColor blackColor];

关于ios - 选择文本字段时 UISearchBar 会更改背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37063564/

相关文章:

ios - 带有node js的部分内容视频流到IOS

ios - 如何检测用户在 iOS 中使用了语音输入?

ios - 在自定义框架中访问应用程序的捆绑标识符

ios - 当我们快速从 Presented ViewController 转到 Previous ViewController 时调用哪个方法

ios - 将 UISearchBar 与 TableView Controller 一起使用并转到另一个 View 时显示问题

ios - CoreData 多次更新 NSManagedObject 会保存多个副本吗?

swift - CVCalendar 编译时错误

ios - 如何在 Swift 4 中使用字符串下标

ios - Swift 搜索栏( Controller )内存泄漏

iphone-sdk-3.0 - UITableView 中的 UISearchBar