【发布时间】:2010-10-08 02:15:59
【问题描述】:
我有一个侧面有索引的 UITableView;我想向它添加一个 UISearchBar,但索引与“x”重叠以清除搜索。我在联系人应用程序中注意到,UISearchBar 中的文本字段已调整大小以适应这一点,但我不知道如何在我自己的应用程序中执行此操作。
我在 viewDidLoad 中尝试了以下方法,但似乎不起作用。
UITextField * textField = (UITextField *)[[self.search subviews] objectAtIndex:0];
CGRect r = textField.frame;
[textField setFrame:CGRectMake(r.origin.x, r.origin.y, r.size.height, r.size.width-30)];
有什么想法吗?
【问题讨论】:
标签: iphone search uitableview