iOS 开发-修改 UISearchController中 searchBar 的取消按钮颜色

查了很多资料,终于找到了方法,亲测有效,非常方便简单!

 [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil]
                      setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor,[NSValue valueWithUIOffset:UIOffsetMake(0, 1)],UITextAttributeTextShadowOffset,nil]
                                    forState:UIControlStateNormal];


你可能感兴趣的:(Objective-C)