简体   繁体   中英

Setting the tint color when using form sheet modal presentation does not work on iPad

I have a UISearchBar in a modal UIViewController that has presentationStyle set to UIModalPresentationStyleFormSheet.

Setting the tint colour on the search bar is only obeyed on the iphone. The iPad still ends up using the app tint color. Any reason why this is happening?

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

您为什么不尝试在applicationlaunch中显示搜索栏。

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

That didn't work for me. What worked was setting the UITextField appearance, but that's iOS7 only. You can also loop over the bar's subviews and change the UITextField's tintColor:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM