【问题标题】:Setting the tint color when using form sheet modal presentation does not work on iPad使用表单模式演示时设置色调颜色在 iPad 上不起作用
【发布时间】:2014-03-24 18:58:58
【问题描述】:

我在模态 UIViewController 中有一个 UISearchBar,它的 presentationStyle 设置为 UIModalPresentationStyleFormSheet。

在搜索栏上设置色调颜色仅在 iphone 上执行。 iPad 最终仍然使用应用程序的色调颜色。为什么会发生这种情况?

  _searchBar = [[UISearchBar alloc] init];
  _searchBar.tintColor = [UIColor whiteColor];

【问题讨论】:

  • 为什么不在应用程序启动中尝试搜索栏的外观。例如:- [[UISearchBar 外观] setTintColor:[UIColor whiteColor]];
  • 这正是我最终所做的!谢谢@pawan

标签: ios objective-c ipad


【解决方案1】:

为什么不尝试在应用程序启动中显示搜索栏。

[[UISearchBar appearance] setTintColor:[UIColor whiteColor]];

【讨论】:

    【解决方案2】:

    这对我不起作用。有效的是设置 UITextField 外观,但这只是 iOS7。您还可以遍历栏的子视图并更改 UITextField 的 tintColor:

    [[UITextField appearance] setTintColor:[UIColor blackColor]];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-18
      • 1970-01-01
      • 2021-11-26
      • 2021-11-11
      • 1970-01-01
      • 2021-12-11
      • 2017-06-25
      相关资源
      最近更新 更多