ios – UISearchBar最小样式在打字时会变黑
2019年07月25日
作者:佚名
当我将UISearchBar设置为iOS7中的最小样式时,当我选择它时,色调变为黑色,并且文本是不可能读取的,因为黑色黑色.
这不会产生预期的结果.选择时色调仍为黑色…
if(floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { // set bar style _sendToSearchBar.barStyle = UIBarStyleDefault; // set bar transparancy _sendToSearchBar.translucent = NO; // set bar color _sendToSearchBar.barTintColor = [UIColor whiteColor]; // set bar button color _sendToSearchBar.tintColor = [UIColor whiteColor]; // set bar background color _sendToSearchBar.backgroundColor = [UIColor whiteColor]; }
解决方法
我有同样的问题,尝试了几个小时,结论是UISearchBar是相当bug!特别是在“最小”模式.
我的
解决方法
是:>将搜索样式设置为默认(突出显示)
>将BackgroundImage(不是BackgroundColor)设置为透明图像,或使用[UIColor clearColor]创建UIImage
>将BarTintColor设置为[UIColor blackColor]
>将TintColor设置为[UIColor whiteColor]
搜索栏看起来像正常的最小模式,
当选择时背景将为白色,因此您可以看到黑色文字.
解决方法
不是很完美,它只是工作,希望可以帮助.以上是来客网为你收集整理的ios – UISearchBar最小样式在打字时会变黑全部内容,希望文章能够帮你解决ios – UISearchBar最小样式在打字时会变黑所遇到的程序开发问题。
如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。