如何在使用UISearchBar时更改UIKeyboard?
问题描述:
我想将UISearchBar的键盘类型设置为UIKeyboardAppearanceAlert,但我似乎无法访问UISearchBar的UIKeyboard。如何在使用UISearchBar时更改UIKeyboard?
答
您需要访问UISearchBar
本身的内部UITextField
。
UITextField *textField = (UITextField *)[[searchBar subviews] objectAtIndex:0];
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
谢谢! 正确的属性是keyboardAppearance的方式。 – 2010-06-15 17:58:54