English 中文(简体)
How does the search display controller hide the navigation bar?
原标题:

When you enter the search bar handled by a search display controller, it slides the view up and pushes the navigation bar up with it. This is easy enough to do, however, when you click a search result and a new view is pushed on the navigation controller s stack, the navigation bar slides in from the right with the view!

How is this done? If you simply set the navigation bar to hidden or shown, it happens instantly. I can t figure out how it seems to be hidden just for one view controller in the stack!

Many thanks,

Michael

最佳回答

You can animate the transition of the navigation bar. See -setNavigationBarHidden:animated: for more details.

If you need to do this on a per-view controller basis, just override the view controller s -viewDidAppear: and -viewWillDisappear: methods, e.g.:

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void) viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

The above will hide the navigation bar when this view controller is pushed on top of the navigation stack, and show the navigation bar when the view controller is popped off.

You can call -setNavigationBarHidden:animated: whenever you want, but those two methods are useful for applying lots of UI changes.

问题回答
-(void)viewDidLayoutSubviews{
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}

it will not hide navigation bar.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签