【发布时间】:2013-10-28 09:02:07
【问题描述】:
我有一个 UIViewController,我想在其中显示一个带有 serchBar 的 tableview。
//viewDidLoad
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
0,
SCREEN_WIDTH(),
SCREEN_HEIGHT())
style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
// adding uisearch bar
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
_tableView.tableHeaderView = searchBar;
//
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
当我在 uisearch 栏内单击以启动动画并且看起来它有 20px 不需要的偏移量时,就会出现问题。
【问题讨论】:
-
你能把我加到 NSChat 组吗?还要在 IB 中试验这些尺寸,看看问题是否仍然存在。而哪些维度会消除这个问题也可以从IB中推断出来
-
你在使用任何类型的动画吗? @卢卡
-
No.. 刚刚将 UIsearchbar 添加到 tableview 标题中。
标签: uitableview ios7 uisearchbar uisearchdisplaycontroller