본문 바로가기
모바일개발(Mobile Dev)/IOS개발(ObjectC)

navigation bar disappeared in storyboard

by 테크한스 2016. 1. 6.
반응형

written by http://stackoverflow.com/questions/16287963/navigation-bar-disappeared-from-my-storyboard-items


From one day to another the navigation bar disappeared from my storyboard items in XCode 4.6.2. I can't restore them (cleaning, rebuilding, closing, reopening etc)

When running my app on my device or in simulator, everything works ok, the navigation bar is there. But I need them on my storyboard during design time, I have buttons, labels there those must be changed now. (pls. don't advise to do it from code, I want to do it on the storyboard graphically, I think that's why it is there)

How can I get my navigation bars back? I hope the solution won't be to delete/do them again as I read in some places, because I have dozens of navigation controllers.

Thanks in advance!

shareimprove this question

Try this:

Select the view controller with the missing navigation bar and view the attributes inspector (This is the fourth tab over in the right side window). Under the simulated metrics section, change the "Top Bar" from the default "inferred" to "Navigation Bar".

Hopefully that solves your problem.

shareimprove this answer
   
Thanks my friend. It works. But why did it disappear? So far it worked by inferred mode. – Tom Apr 29 '13 at 20:56
1 
There might be multiple navigation controllers that lead to that particular view controller, or perhaps even a container view? XCode can get pretty finicky in these cases since inferred doesn't always know which direction it's coming from. I've noticed a lot of unpredictable behavior with inferred and have many of view controllers specified as I described. I suppose that's why the functionality is there. – csundman Apr 29 '13 at 20:58
   
Okkey, thanks a lot! – Tom Apr 29 '13 at 21:00
   
Thanks for this. I saw other questions on this without a decent answer. – gdbj May 18 '13 at 21:30
   
thanks my friend – ashokdy Oct 21 '13 at 12:31

Specifically for xcode 6, under the simulated metrics section (fourth tab on the right window), under the "Top View" dropdown, pick the "Translucent Navigation Bar" to get the default nav bar.




Please help! 
I'm using Swift btw.

UPDATE: 
Solved it by looking at the SWRevealViewController examples
3 Answers
Eric Harmon
Eric HarmoniOS developer
2.4k Views • Eric is a Most Viewed Writer in iOS Application Development.
What is the previous setup look like? We can't tell what it looks like prior to the SWRevealVC. What storyboard does by default is it infers if there should be a navigation bar or not by default.

So what happens is if you have a NavController -> VC set up, then by default there is a nav bar. It's inferring that there should be a nav bar, which is correct.

However, in the case that you're pushing from SWRevealVC and SWRevealVC is NOT in a Nav Controller, then when you push, it's inferring that there shouldn't be a nav bar. That's why it's disappearing. You can try to force it to have a nav bar by going to the VC and manually selecting what type of nav bar it should have. This should make it show in the storyboard. However, you'll have to also run code to see if it will actually show or not. If there is no nav bar when you run it, then you'll need to embed your SWRevealVC in a Nav Controller.
Mohammed Islam
Mohammed Islamdeveloper since 13
1.6k Views
When you run it, is the navigation bar shown or not? The interface builder is a helper tool, not the actual results. For example you can change the settings in interface builder for that last view controller to display the navigation bar or not, but that won't have any impact during runtime.
Also make sure that the navigation to that last view controller is a push and not a present.
Anonymous
Anonymous
1.3k Views
Solved it by looking at the SWRevealViewController examples :-)





반응형