我有一個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 –