简体   繁体   中英

How can I hide the navigation bar when pushing a view controller?

I'm making customized UIScrollView such like pinterest's two column view.

The scrollview should have search function. So I tried to use UISearchDisplayController but I can't because UISearchDisplayController implements only UITableView.

So, I created search display controller such like UISearchDisplayController. It's good. well done.

But I have a big problem. I can't implement completely behavior of UISearchDisplayController when go to detail view.

See below images.

this image is UISearchDisplayController's behavior on Simulator's Contact App.

在此处输入图片说明

Detail view have a navigationBar when pushed. but first view's navigationBar is hidden.

在此处输入图片说明

The UISearchDisplayController's behavior is good to transition view. Search view don't have UINavigationBar and detail view has UINavigationBar separately. but my controller can't do that.

I call setNavigationBarHidden:animated method try to hide navigation bar when touch UISearchBar on search view.

How to implement second image. any ideas?

sorry for my bad english :)

The search bar is different view, so here you need to call the below methods while view is navigating from one view to others.

self.navController.navigationBarHidden = YES;

or

[self.navigationController setNavigationBarHidden:YES animated:animated];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM