我正在尝试设置UISearchBar
的barTintColor
,但不想让它透明。然而,设置translucent
属性似乎没有任何作用。我已经在这里的Xcode项目中复制了这个问题。
self.searchDisplayController.searchBar.translucent = NO;
self.searchDisplayController.searchBar.barTintColor = [UIColor redColor];
上面的红色并不同于在不透明的
UIViews
中使用[UIColor redColor]
。我知道有一种解决方法是在搜索栏上设置背景图片,但是以上代码也应该可以工作。