我在标题视图下方有一个 UISearchBar。此页眉高度为 64 像素。如果搜索栏被触摸,父视图将向上移动 64 像素——很好。
完成搜索后,父视图只会向下移动,只要它下面还有空闲空间。并且顶部超出了可见范围。
但每次搜索完成时,我都想将其移回原始位置。我怎样才能实现它?
我在标题视图下方有一个 UISearchBar。此页眉高度为 64 像素。如果搜索栏被触摸,父视图将向上移动 64 像素——很好。
完成搜索后,父视图只会向下移动,只要它下面还有空闲空间。并且顶部超出了可见范围。
但每次搜索完成时,我都想将其移回原始位置。我怎样才能实现它?
实现UISerachDisplayDelegate
- 方法-searchDisplayControllerDidEndSearch:
像这样:
- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller{
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}