views:

346

answers:

1

To explain what I'm looking for I'll give an example: In the Contacts app, when you click the Search field in the first row of the table view it will smoothly take over the entire screen (minus the status bar) including the Navigation Controller's title bar.

Edit: I've also realized that I'm pretty sure this is related to the UISearchDisplayController being within a UITableView which is within an NavigationController which is within a TabBarController. The problem is that the search display will only take up the tableviews size and not the navigation controller.

I've mimicked this in my program by using UIView animations and resizing the entire navigation controller's frame to start above the visible screen's view. See below:

-(void)SetNavContTitleVis:(BOOL)ishidden {

    [UIView beginAnimations:@"frame" context:nil];
    [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration: 0.3];
    CGRect frameIn;
    if (ishidden) {
        frameIn = CGRectMake(0,-46,320,480);
    } else {
        frameIn = CGRectMake(0,0,320,480-46);
    }
    self.parentViewController.view.frame=frameIn
    [UIView commitAnimations];

}

This works fine and gets the job done but it feels like a hack. Is there any simpler way to do this with search display controllers? I feel that this is a hack that will get me into trouble in the future if display sizes change or the Apple tablet comes out etc. I've looked around for a while but haven't found any simple setting that will force the UISearchDisplayController to take up the navigation controller's title bar smoothly.

A: 

The search bar should animate like that by default. Check out Apple's sample TableSearch.

gerry3
I guess the example wasn't the best. I have a navigation controller With a tableview in it all inside of a tab controller. The search controller doesn't go all of the way to the top unless I use this method. It will simply animate to the top of the table view since it is the tableviews search controller. I think I may be forced to do the hack because of the complexity of the setup.
mjdth