【问题标题】:UISearchBar: different style depending on iOS versionUISearchBar:不同的样式取决于 iOS 版本
【发布时间】:2013-11-12 10:10:25
【问题描述】:

如果在 iOS

在 Xcode 图形布局中搜索栏是黑色的。

有没有一种简单的方法可以对应用程序中的所有搜索栏执行一次?

我对 iOS 开发还很陌生,所以请耐心等待并清楚:)

【问题讨论】:

    标签: ios iphone ios6 ios7 uisearchbar


    【解决方案1】:

    您可以使用如下代码更改设置:

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        // iOS >= 7   
    } else {
        // iOS < 7    
    }
    

    如果您的应用中有很多条,您可以继承 UISearchBar 并在其中使用此代码。

    【讨论】:

    • 谢谢,我将 UISearchBar 子类化并将控件放入 initWithCoder 初始化程序中。然后我将所有搜索栏都更改为自定义类。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-11
    • 2019-10-24
    • 1970-01-01
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多