Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

ios - UINavigationController without navigation bar?

I have a universal app, and on the iPad version I'm using UISplitViewController to create an interface similar to the Mail app.

I was having trouble pushing new Detail views, so I decided to use a UINavigationController so I could just push and pop views as needed. However, I do not want to use the navigation view or a toolbar. But no matter what I do, I can't hide the navigation bar.

I've tried unchecking "Shows Navigation Bar" in IB, and I've also tried setting:

[self.navigationController setNavigationBarHidden:YES];

in the viewDidLoad/viewDidAppear/viewWillAppear. I've also tried it in each of the views that will be pushed. Nothing works.

Is there something I'm missing here? Is it possible to have a UINavigationController without a toolbar or navigation bar?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should be able to do the following:

self.navigationController.navigationBar.isHidden = true //Swift 5

where self.navigationController is (obviously) an instance of UINavigationController. Seems to work for me, but I only briefly tested it before posting this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...