My application has a UIViewController which is embedded in a UINavigationController. The UIViewController has a container view inside it. I connect this container view to a UITableViewController thereby embedding it in the container view. It's fine until now.
Now when I connect this UITableViewController to a new UIViewController using the push segue (we are still in the navigation view) in the storyboard, the size of the new UIViewController scene becomes same as that of the container view. I guess this is expected but is there some way not to make this happen. I want the remaining scenes to be in the normal size. Also, its working pretty fine and as expected when running in the simulator. The problem with the size is only pertained to the storyboard.
Just explaining my controller - view hierarchy here:
UINavigationController
-> UIViewController ( Initial View Controller )
-> Container View
-> UITableViewController ( Embed Segue )
-> UIViewController ( Push Segue )
Is there any way so that the last UIViewController and the remaining connected controller scenes are of normal sizes in the storyboard?
Here is one solution: Create a manual segue from your Initial View Controller to the desired destination. This will prevent the storyboard from getting confused and giving the destination the wrong size (and other inferred metrics). Unfortunately, because it is a manual view controller, you will have to perform the segue in code from your embedded view controller by doing something like this:
[self.parentViewController.parentViewController performSegueWithIdentifier:#"MySegue" sender:self];
As of Xcode 7 (I'm not sure if this applies to previous versions):
Select the view controller that is embedded inside your container view.
In the Attributes Selector, there are five drop downs at the top under Simulated Metrics.
Set Size to Master
Set Status Bar to Default
Set Top Bar to Translucent Navigation Bar
Now drag a UINavigationItem onto your view controller.
This will give you the correctly sized view controller and a navigation bar to edit.
Related
I have a UITabbarController at the very beginning of my navigation. There is 4 tabs which are referred to 4 different storyboards.
In one of the storyboards the starting point is a UINavigationController which is the root of a viewcontroller. In that viewcontroller there is 2 containerviews. One is for topbar and the other one is for my below contents for further navigation. Now, the below containerview's viewcontroller is embed in a navigationcontroller for navigation purpose. Now when I am running my project I am seeing a space below my first view controller that is embed to that below container view with a navigation controller.
I am attaching screenshot for better understanding of my problem.
This is the first controller:
Now this is one of the four tabs:
Now what I am getting as output is:
P.S: I have not written any codes for anything untill now.
Try to turning on Extended Egdes > Under OpaqueBars checkbox on view controller with container view.
Basically, with this property you set which sides of your view can be extended to cover the whole screen
This property is applied only to view controllers that are embedded in
a container such as UINavigationController. The window’s root view
controller does not react to this property.
I have 3 View Contorller
First View controller have Container View of height 300.0f at the center.
It has one embedded view Controller which is table View controller.
On cell selection it should navigate to detailsViewController.
All the process is ok.
But detailsViewController is not behaving as embedded view controller of containerView and not of same size as container view.
It takes whole screen size.
As it is triggered from the embedded View Controller it should follow that frame without overlapping other controls which are in First View Controller.
You need to embed not view controller with table view, but embed navigationController(you can hide navigation panel on up side), end set yours table view controller as root for it, and use pushViewController to go to detail page.
hope ganesh this will help you
Look You have a Container View inside it you have a tableView and By clicking an cell you pushing another viewController that what i concluded after reading your question(hope you done everything in modular way).
Now you must have UIView subclass(i.e separately creating a view class ) inside which you have a tableView so you pushing by
[self.nav pushViewController:sos animated:YES];
there are two way to push ViewController inside a view first by Callback(through blocks) or passing Navigation ref. in UIView Class .So you are pushing the new Controller over the navigation thats why it showing this behavior and which is obvious.
I've got a static table view as the main screen for my app right now, which is embedded in a container of the root view controller. the problem that i'm having is all of the items/pages that come from the original static table do not show a navigation bar in the storyboard. how to you recommend fixing this so I can use my UINavigationController in this container table. thank you.
Scenes in storyboard that do not come from a controller that has a navigation controller do not inherit the nav bar. To see what it looks like with a nav go to the scene in storyboard, then Attribute inspector from the right panel and change that controller to show a top bar instead of Inherit. This is useful when the code is adding the controller to the stack but there is no direct connection in storyboard from the controller to a navigation controller.
Now if your problem is that when you run the app app Segues from the static table push to controllers where there is no nav bar, this could be a result of embedding a tableViewController in a containerController. Maybe try setting a delegate on that TableViewController on the didSelectRow method and telling the Parent of the container to push.
I have a UIViewController which segues (push) to another UIViewController. The first controller contains a nicely laid out UIToolBar menu and I want this to persist over the secondary UIViewController (and another other ones I push on the navigation stack).
Is this possible?
This can be done with a container view in a storyboard, or using the custom container view controller api in code. In the storyboard, you can add your tool bar to a view controller, drag in a container view, and size it to take up the rest of the view. You will automatically get a view controller connected with an embed segue to the container view. Select it, and embed it in a navigation controller. You can use prepareForSegue (which will be called immediately after your main view controller - the one with the container view - is instantiated) to get a reference to the navigation controller (it will be the destinationViewController).
I've created something similar to the picture I've added.
I've connected using Ctrl+Drag the UIButton to the Child View 2 ViewController and selected push segue.(the picture shows custom segue, ignore it please)
My problem is that when I tap the button the new ViewController is in full size (covering that all screen)
How can I force it to stay in the same size of the original Container?
Edit:
From the answers i've found that Embedding VC B in a new navigation controller does force VC C to be pushed in smaller size, I would like to understand why I can't use the original Navigation Controller. to do the same thing
What you say you're doing isn't possible. You can't do a push if your controller isn't embedded in a navigation controller. If you embed Child View 1 in a navigation controller, what you're trying to do should work.