HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – UISearchBar最小样式在打字时会变黑大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我将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最小样式在打字时会变黑所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。