UINavigationBar not showing up in modal view - iphone

I have a storyboard as seen in this picture:
From a table view cell, I modally present a new view controller which is a subclass of UITableViewController. In the scene on the RHS I have a UINavigationBar. But when my view is presented, it does not have it. Why is that? Thanks!

You'll need to embed your subclass of UITableViewController that you want presented modally inside of a UINavigationController.
To do this, click the view you want presented modally in your Storyboard, then go to Editor>Embed In>Navigation Controller.

Related

Xcode - Show segue from modal view controller

I am presenting a modal view controller with a tableView, and then want to perform a push segue when a cell is tapped inside the modally presented view controller.
I set up a view controller and a show (push) segue from the modal view controller to the new view controller, but when I call performSegueWithIdentifier, the new view is presented in a modal fashion (slides up) on top of the initial modal view, instead of coming in from the right.
Anyone know what's going on?
Thanks!
For anyone who has this issue in the future, I figured it out:
You need another navigation controller. So I perform a modal segue to a new navigation controller, and set the modal view controller as the root view controller of the navigation controller. I can then perform a show segue from the modal view controller to any other as normal.
:)
As of Xcode 11.4 (possible earlier) you can also just select the destination view controller and in the right inspector pane under the attribute inspector you have the option: "Transition style" and "Presentation" which will allow you to change from Automatic to Full Screen for example. That way you can overwrite that when you use "push" from a modally presented view controller, the segue will always present the next view controller modally.

open UITableViewController as an item of UItabbarcontroller

I created an UITabbarController that its first item is an UIViewController, this UIViewController contains a button that must open UITableViewController.
I created the UITableViewController and UIViewController in the StoryBoard and gave them identifier name.
my problem is,when I press the button that is in the UIViewController to open the table, it opens the UITableViewController but without the tabBar and I want the UITableViewController be as an item from the tabBar (item opens other item)
how to do this ?? can anyone show me sample code
sorry for my bad explanation.
consider that I'm using Xcode4.3
Embed ur view controller inside a navigation controller. make this navigation controller as the tabBar Controller's view controller(first item) .Don't present the table view controller modally . instead segue it using navigation controller.

How To Set Up Table In Modal View

I have a TableView, when you click add + button in nav bar, it brings up a modal view that will have another separate table in it which will have subviews etc.
So far, I have the tableViewController and the model view is in there as a UIView. My question is, how do I setup the tableViews that go in the modal view? Do I make new classes for the rootview and subviews etc? Should I switch the modal view to its own class also?
You can put the modal view in a Modal View Controller and do a presentModalViewControllerAnimated to show it.
The modal view controller is a UIViewController subclass and in that class you can manage all the stuff you want to do in your modal view.

UISplitView with UINavigaionController detailView

I see there is UINavigationController as masterView in UISplitView.And the detailView has a UIToolBar at most but isn't base on UINavigationController.
So I would like to make the detailview base on UINavigaionController then I can pushViewController to show other controllers.
Can somebody show me how to implement?
You can add a UINavigaionController in your detail view class. Then, create the view by UINavigaionController and add to your detial view class.

UINavigationView in modal view

I would like to place a UINavigation View within a Modal view but I am having loads of problems. I managed to get the modal view working, but when trying to put a UINavigationController in it it just comes up with a blank screen.
Does anybody know how to do that properly?
Create a UINavigationController, initialize it with your UIViewController at its root, and then present the navigation controller modally.