我有一个 UISearchBar,我需要相当大(68 像素的高度)。我尝试从 xib 的源代码调整大小以及从 UISearchbar 更改 UITextField 的 subview ,均未解决问题(如下图所示):
尝试设置外观(除高度变化外一切正常):
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setFont:[UIFont fontWithName"HelveticaNeue-Light" size:48]];
UITextField *searchField = [self.searchBar valueForKey"_searchField"];
searchField.textColor = [UIColor whiteColor];
searchField.keyboardAppearance = UIKeyboardAppearanceDark;
searchField.autocorrectionType = UITextAutocorrectionTypeNo;
CGRect searchFieldRect = searchField.frame;
searchFieldRect.size.height = 100;
searchField.frame = searchFieldRect;
Best Answer-推荐答案 strong>
刚刚使用带有文本字段通知的 UITextField 来判断文本何时更改并调用我的搜索方法。
关于iphone - UISearchBar 高度未调整大小,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/19123143/
|