这个问题其实可以取个巧路,大家都知道设置SearchBar的tintcolor的方法
searchBar.tintColor = [UIColor blueColor];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil]
setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
UITextAttributeTextColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
UITextAttributeTextShadowOffset,nil]
forState:UIControlStateNormal];
如此,取消按钮的颜色即为想要的颜色了!
时间: 2024-10-12 03:09:24