iOS: Keeping UIToolBar on top during segue - ios

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).

Related

iOS custom view across all view controllers

I would like to have custom view set in one screen and have it across all view controllers in my application.
I find solution with using Container view. So I create RootViewController and I give it Container view and set my original MainViewController as embed in container. I added view to RootViewController and in first view controller (MainViewController) it looks good.
The problem is when I go to another view controller by Push segue. New view controllers covers whole screen (which is okay) and covers custom view too. I was thinking that it could help if I add Navigation Controller with root MainViewController and this navigation controller would be embed in RootViewController but the result is same. I set Navigation bar as hidden (same for status bar) because I want to be hidden.
So where could be problem? Or how would you add custom view to all screens? This custom view should work as global (I am using NSTimer and counting time) so I solution with inheritance isn't for me.
You can use application window and add this custom view as subview whenever required. I have used it in one of my app to show notifications (if there area any) and it works great.
Get handle to Application Window and add subview to it. Custom view can be created from a singleton class or App delegate.
You could try it the other way round. Make a view which will never change inside your root view controller and a container view and just change the content of the container view depending what u want to display next to your unchanging view.

ContainerView nextViewController is not child stacked to container view as subview

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.

Navigation controller with static table in container view

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.

Segue from the view controller embedded in a container view

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.

IOS Container View and Push Segue

I have a container view which is linked to a child view controller with embed segue and it is linked to another view controller(My View Controller) with push segue on a button.
My problem is; I can't display a subview that is added in container view in My View Controller with storyboard configuration like figure.
If I added one more same container view(Banner View Controller) before My View Controller, exists infinite loop.
How should i do to solve this issue?
I use Apple's TabbedBanner iAd With StoryBoard example.

Resources