我有一个RectEdgeAll视图控制器的tableview并作为其的tableview报头中的搜索栏。当我开始搜索时,搜索栏开始动画并定位到屏幕顶部的正常位置,但是tableview没有跟随它,它在开始搜索之前保持在同一位置,在两个视图之间留下间隙。我如何使它与搜索栏一起生成动画?的iOS 7 searchdisplaycontroller和的tableview偏移不同意偏移
我已经尝试过更新的tableview的contentOffset当搜索的开始,但它甚至没有移动。
尝试了两种方式的tableview和搜索栏:代码和故事板。
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.dataSource = self;
self.tableView.delegate = self;
//self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
self.searchBar.delegate = self;
self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self];
self.searchController.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view addSubview:self.tableView];
self.tableView.tableHeaderView = self.searchBar;
}
之前搜索:
查看此页面http://myioscodingtips.blogspot.ca/2013/10/uisearchdisplaycontroller-in-ios6-ios7.html –