UISearchBar高度没有调整大小

时间:2013-10-01 18:18:26

标签: iphone ios uitextfield uisearchbar

我有一个UISearchBar,我需要相当大(高度为68px)。我已经尝试从xib的源代码调整大小以及从UISearchbar更改UITextField的子视图,既没有解决问题(如下图所示):

尝试设置外观(除高度更改外一切正常):

[[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;

Result:

1 个答案:

答案 0 :(得分:1)

刚刚使用带有文本字段通知的​​UITextField来判断文本何时发生了变化并调用了我的搜索方法。