Default UIKeyboardType for iPad for UISearchBar



我有一个隐藏的按钮,通过使UISearchBar成为第一响应程序,可以为UISearchBar打开一个UIKeyboard。我试过将键盘类型更改为不同的键盘,比如:

self.SearchBar.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

但我仍然默认使用相同的键盘,字母优先。有没有办法默认数字,因为我只需要iPad的数字?谢谢

答案似乎是,当创建searachBar时,必须设置keyboardType(例如在viewDidLoad中)才能生效。

最新更新