views:

37

answers:

1

I have a UISearchBar below a header-view. This header is 64px hight. If the searchbar gets touched, the parent view will move 64px up — fine.

After finishing searching the parent view will only move down, as long there is still free space below it. And the top is out of the visible bounds.

But I want to move it back to the original position every time searching finished. How can I achieve it?

A: 

I found a solution:

Implement the UISerachDisplayDelegate-method -searchDisplayControllerDidEndSearch:

like this:

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller{
    [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] 
                          atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
vikingosegundo