, , Apple , , UITableView . , , UIViewController UITableView UISearchBar, tableView .
, UISearchBar , , .
. :
WillAppear:
- (void)viewWillAppear:(BOOL)animated {
CGRect newBounds = self.tableView.bounds;
if (self.tableView.bounds.origin.y < 44) {
newBounds.origin.y = newBounds.origin.y + self.searchBar.bounds.size.height;
self.tableView.bounds = newBounds;
}
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:0 animated:YES];}
, , , , :
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
[self viewWillAppear:YES];
}
searchBar :
- (IBAction)displaySearchBar:(id)sender {
[self.searchBar becomeFirstResponder];
}