在iOS6的
问题描述:
的UISearchBar setBarTintColor无法识别的选择例外,我有一个例外,在iOS6的:在iOS6的
-[UISearchBar setBarTintColor:]: unrecognized selector sent to instance 0xad94250
,但我没有在我的代码这种方法。我该如何解决这个问题?
答
barTintColor可用的iOS 7及以上的,所以它会为IO7及以上的只有
@property(nonatomic,retain) UIColor *barTintColor NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR; // default is nil
对于iOS 6.1工作,并降低你必须使用
@property(nonatomic,retain) UIColor *tintColor;
答
我忘记了属性。
self.searchBar.barTintColor = [UIColor whiteColor];
你可以做有条件检查,看看你是否在iOS7或更低。 如果你在iOS6上使用'tintColor',否则在iOS7中使用'barTintColor' –