UIStoryBoard Navigation Controller disappearing after segue - objective-c

Reference layout via storyboard:
http://i.imgur.com/M7AmdP2.png
Reference landing page:
http://i.imgur.com/Y3g45uy.png
I am trying to use the bottom bar as displayed in picture 2 to control my app. When I select my option on the first page (Such as the songs tab), but when I go to the next page my navigation bar at the bottom disappears. I am using segues to direct my applications view flow.
I have tried making various controllers subclassed to a UITabBarController & pushing as modal. Neither of those kept the navigation controller

You shouldn't have that navigation controller as the initial controller, the tab bar controller should be first. Then, in each of the three tabs, the root view controller should be a navigation controller, followed by the ones you show in your image.

Related

Show or Present ViewController?

I have an app in swift that starts with a rootViewController containing 3 buttons.
The first one should open a tabViewController with 3 tabs in it.
The second one should open a navViewController with a nested TableViewController that opens another tableViewController
The last one should open a regular view controller with 2 buttons, both opening a navController with a nested tableViewController
Which is the best "pattern" to use? should I use a ContainerViewController as root?
Which method is best to use for the main 3 buttons of the rootViewController to open the related controllers, the show or the present?
This is a sketch of my app: http://i60.tinypic.com/6jq537.png
The main thing to ask is how are these separate views related? And how are they related to the "menu" view at the beginning?
Tab View -
Nested Table View -
Another menu to two more tables...
First I'll go through how I would build each individually...
Tab View
I would probably create this in its own Storyboard. You don't specify if the tabs will have their own navigation in them? If so then each tab should start with a NavigationController. i.e. 1 tab bar controller with 3 tabs. 3 navigation controllers (one per tab) and then the root view controller of each navigation controller will be the content of the tab.
Nested Table View
The navigation of this should be handled in a navigation controller. So you either want to present a navigation controller with the first table view controller in it or you want to use a navigation controller to present it in the first place.
Third view
This is essentially a duplication of the menu view. Except each button goes to the Nested Table View mentioned above. Again, you will need a navigation controller.
What I would do
You probably should be starting with a Navigation Controller as your root view. If you want to get back to your menu view easily then that would make sense.
Then the issue of button 2 and 3 are trivial as you just push them onto the navigation controller.
For the tab bar controller I'd also push it onto the navigation controller but maybe think about hiding the navigation bar during the transition so as not to get caught up in which navigation controller is doing what.

Creating an View without the navigation Item bar in Xcode

I am trying to connect a new empty View(homeScreen) from a ViewController (loginScreen) using Xcode 6 Beta 4 and Swift. A button triggers the segue to the homeScreen View. The problem is that when I add the segue, my blank/empty homeScreen View magically gets a Navigation Item Bar on top of the view.
You can see that without the segue my homeScreen View its empty:
After the segue it looks like this:
As you can see, Xcode inserts the Navigation Item Bar on top (grey rectangle). I would like to know how to get rid of it or how to create an empty View that remains empty even after assigning a segue to it.
Thank you so much for your help!
Cheers!
UPDATE: My goal is to create a navigation bar kind of like the one Facebook implements in its' iOS app. On top have the search bar and maybe some more icons. Does anybody know how to do that? I tried to hide the Navigation bar by selecting my view controller and in the Attributes inspector setting the "Top Bar" attribute to none, but it does not work. Any suggestions?
Thanks again.
Does loginScreen is inside a UINavigationController? If it is, the new showed view controller (homeScreen) is supposed to be in the navigation controller too, and thus it has a navigation bar by default.
You can hide it if you want, but then you have to find an alternative way to navigate in your navigation controller.
Otherwise you can present the homeScreen modally changing the type of segue to "Present Modally".
For more details on view controller presentation see this document plus some updates in iOS8 (WWDC session: View Controller Advancement in iOS8).
EDIT: To implement the FB-like navigation bar I would customize the UINavigationController bar:
read this AppCoda tutorial about customizing the bar
to add a search bar use the code like:
let searchBar = UISearchBar()
...
self.navigationItem.titleView = self.searchBar
This is because the segue is a "push" segue ("Show (e.g. push)") from a View controller that is already included in a Navigation controller. Therefore, it is put in the stack of views of this Navigation Controller, and therefore receives a navigation bar.
If you don't want a navigation bar, then use either a modal segue ("Present modally"), or a custom segue.
Same thing if you need a different navigation Bar (not linked to the first Navigation Controller). You can perfectly have a modal segue leading to a UIViewController, which is embedded in its OWN navigation controller (or having only a navigation bar). Have a look in the menu: "Edit / Embed / Navigation controller".

UINavigationController hiding navbar with custom transition delegate in iOS7

I have a UINavigationViewController with two view controllers. The root view controller needs the navigation bar to be hidden, while in the second view controller, the navbar is visible.
I implemented custom transitions with UIViewControllerAnimatedTransitioning
When I push the second view, everything is fine. However, when I pop the view and return to root, there's a jump in the root controller frame. It animates in as though it has a navigation bar and when the animation completes, the frame is re-adjusted to full-screen.
What's the proper way to do this? The default transitions don't display this problem.
Two simple ways to fix it:
Hide the navigation bar entirely from the navigation controller and add a custom navigation bar to the first screen, independent on the navigation controller.
Let only the first screen to be in a navigation controller and create a custom transition to the second screen, not using navigation controller's push but implementing the push animation by yourself.

Creating a custom NavigationBar instead of using NavigationController.navigationBar

I'm making a custom navigation bar for my navigation controller based app, which has the default navigationBar hidden property set to true. Using the default navigation bar is out of the question because it was causing a lot of issues due to the degree in which I need to customize it (complex animations, changes in height, etc).
I'm currently adding my "navigation bar", which is just a UIView, to the view of the UIViewController. So of course, when I transition to a new view, the old navigation bar falls away and the next view controller doesn't have any navigation bar. What I'd like to do is make my navigation bar behave more like the default UINavigationController navigation bar, where it stays fixed to the top and the new and old elements cross-fade during the VC transition. How can I accomplish this effect without using a UINavigationBar?
Thanks so much!
You should use a custom container controller with your custom navigation bar at the top, and a view below to which you add a child view controller's view. That child view controller could be a navigation controller with its navigation bar hidden to handle the transitions. You would have to have the incoming controller (or outgoing I guess) send a message to the container controller to tell it to do the cross fade of its navigation bar.

UINavigationController with UITabBar live bytes

I have a navigation controller with 3 view controllers. The third view controller contains a UITabBar and each tab on the tab bar has its own separate navigation controller. When I'm pushing and popping view controllers on the tab bar navigation controllers, all allocations work fine. They rise and decline accordingly. But when I pop the navigation controller that hosts the tab bar (the third VC) back to the second view controller(a view controller without the tab bar) and then back to the third VC again (the one hosting the the tab bar), the live bytes grow to more than what they were before when previously on that same viewcontroller.
Is there something special I need to do when popping the from the tab bar back to the view controller without the tab bar???
Or any other thoughts
I'm using ARC
I also do not use a sub class of UITabBar to control the tab bar
The problem was I was pushing a uitabbarcontroller onto and navigation stack and from what I understand this is not possible.
So instead I start the app out with the uitabbar and display a separate navigation controller as a modal