从UISearchBar更改UIBarButtonItem [英] Change UIBarButtonItem from UISearchBar
本文介绍了从UISearchBar更改UIBarButtonItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改iOS 8中UISearchBar内的取消按钮的文本字体和颜色。我已经尝试过iOS 6和7的解决方案,但它们似乎无法正常工作。
I'd like to change the text font and color of the Cancel button inside the UISearchBar in iOS 8. I've tried the solutions for iOS 6 and 7 already and they don't seem to work.
推荐答案
这不是我想要的解决方案,但它确实有效。
This was not the solution I was looking for, but it worked.
let cancelButtonAttributes: NSDictionary = [NSFontAttributeName: FONT_REGULAR_16!, NSForegroundColorAttributeName: COLOR_BLUE]
UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, forState: UIControlState.Normal)
这篇关于从UISearchBar更改UIBarButtonItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文