Multiple Push Segues to One View Controller in Storyboard - ios

I have an application in Xcode 4.6 that uses storyboards. The root view controller is embedded in a navigation controller, and all view controllers in the application are accessed via push segues via the navigation controller.
I ran into a complication when I wanted to have one particular view controller (called photos) accessed via a push segue by two different view controllers. I ended up with what appeared to be a navigation controller inside a navigation controller in the photos controller after I added the second segue. The goal is to just have (in photos) one navigation bar with a dismiss button that (when pressed) pops back to whichever of the two view controllers presented the photos view controller. I am somewhat new to iOS and I am not sure of the best way to accomplish this or how to generally handle this situation.
Here is a picture of my storyboard for reference:

You should really do it programmatically using SotyboardID. It's only a few lines of code in each ViewControler.

Related

Launching to a level other than root in UINavigationController, from a storyboard

Is it possible to launch an app to a specific level of a navigation stack using a storyboard?
I'm looking to recreate the model employed by Mail.app, where the app launches into the Inbox, but this is actually one level down the navigation stack, and tapping the back button takes you to the root...
I understand how this can be done via code, i.e. instantiating the navigation controller within the app delegate and then manually pushing the view controller(s) to create the desired stack, but I'd really like to know if there's a way to achieve the same using storyboards.
Unfortunately I don't think there is because you need to instantiate your navigation controller at some point that will house your view controllers, and if you do this through storyboards the best you can do is set the navigation controller to be the entry point.
However, it is pretty straightforward to do from code. If your navigation controller has two view controllers where ViewControllerOne pushes to ViewControllerTwo, then you can just can just push to the second one without an animation as follows:
navigationController.pushViewController(secondViewController, animated: false)
And the user will be one level deep in the navigation controller.

SWReveal Menu on Multiple View Controllers

I am developing an application where I have multiple view controllers who should be able to access the reveal side menu. I am not using the navigation controller though, and am just using regular view controllers and opening the menu with a button. On the first screen, which I have linked with sw_front, it works.
If I go to another screen which I added an sw_front segue to too, it won't work. How can I get it to work on all view controllers which are linked? It seems to only work on one...
Screenshot of storyboard:
Storyboard screenshot
Add reveal view controller before it where you want like first view controller .
And one more thing if you are Access from SW_rear ,then set_push method gave by swrevealviewcontroller.

How to push and pop view controllers in UISplitViewController in iOS?

From Apple's Documentation,
When designing your split view interface, it is best to install
primary and secondary view controllers that do not change. A common
technique is to install navigation controllers in both positions and
then push and pop new content as needed.
My app has a UISplitViewController as a root view controller. As per documentation, I created two dummy navigation controllers(say primaryNC & secondaryNC) and placed them as primary & secondary view controllers in UISplitViewController using the setViewControllers: method.
My primary controller is a tab bar controller, and the secondary controller is normal UIViewController.
I can not find how to push/pop view controllers into primary/secondary navigation controllers. Redirecting to any example code would be helpful.
P.S: I am doing this programmatically not using nib/xib. I am using objective c.

Difference between navigation controller and viewcontroller?

Difference between navigation controller and viewcontroller?
I mean how can we decide when to use navigation controller or a normal view controller?
Just my two cents:
A UIViewController represents a single view and you can put buttons in this view controller to segue to another UIViewController. If you want to segue back to the first UIViewController, you will have to worry about putting a button in the second view controller that leads back to the first. If you are drilling down into view controllers, this can be tedious having to remember to give the user a way back to a previous view controller.
A UINavigationController does a lot of this tedious work for you. As mentioned, it contains a stack of UIViewControllers. It will create a navigation bar at the top that will allow you to easily go back up the hierarchy of view controllers.
In short, if you have a hierarchy of view controllers that you want the user to easily navigate around, inbed your UIViewControllers into a UINavigation controller.
UINavigation Controller is a combination of 2 or more view controllers,those are connected through "segue" feature of "Ios". Benefit of using Navigation Controller is that we can navigate between different screens easily with default "Back" button on each screen . We don't need to give any individual button to move back onto previous screen.
Whereas a ViewController provides a single screen & we can connect more screen using "segue" but we also have to design a "Back" button to navigate onto previous screen.
We should use Navigation Controller , in case where one option resides into another one.Like in an iPhone settings ->Mobile Data Options->Voice->4G or 3G or 2G. It's a hierarchy of menus so here navigation Controller is better option than using UIController.
We should use UiController with "segue " , in case where
we have to choose one option among multiple.Like -
Photos ->There are many folders in which , any one is selected, that are Favourites or People or Places .
Here's a very brief, high-level overview.
Whereas a UIViewController can be thought of as representing a single 'screen', UINavigationController, as the name implies, is used as a means of being able to navigate multiple 'screens'.
From the documentation:
The UINavigationController class implements a specialized view controller that manages the navigation of hierarchical content. This navigation interface makes it possible to present your data efficiently and makes it easier for the user to navigate that content. You generally use this class as-is but in iOS 6 and later you may subclass to customize the class behavior.
Please see the rest of the UINavigationController documentation here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationController_Class/index.html
Okay, Thank you everyone for helping me to find out a clear answer on this.
Navigation Controller consists of navigation bar and tool bar to move in and out from view controllers present in navigation stack.Therefore there can be many view controllers in Navigation Controller.
In view controller we don't have this facility and it represents a single screen view.
Please correct me If I am wrong.
See the Navigation Controller discussion in the View Controller Catalog.
Bottom line, a navigation controller actually is a view controller, but it just happens to be one that presents and navigates between other view controllers.

Use of differenct view controllers

i'm curious about what's the best way to plan the controllers for my app.
i want my main screen to have 3 button.
1) should open a nav controller with details view
2) should open a controller with other buttons that lead to others controllers
3) should open a tab bar with 2 pages ( or eventually use a switch to change page instead of the tab bar)
this is the schema of what i want
http://i59.tinypic.com/2rrvrd4.png
Is it a correct schema or i should use my controllers differently? will apple reject an apple with such schema?
thanks
As #Fogmeister pointed out in the comments, going for a UITabBarController as the main interface for your app actually seems to be a more appropriate solution here.
However, you can go with the interface that you described, but then you should keep in mind that with your current setup, you are not only using UINavigationController in the first case, but your whole navigation system is still built upon UINavigationController in the following way:
Your app has one instance of UINavigationController.
Your initial UIViewController (the one with the three buttons), is the rootViewController of your UINavigationController.
You can navigate to the other view controllers using [self.navigationController pushViewController:newViewController] (or performSegue if you prefer using Storyboards).
In the case of your third view controller, you are pushing a UITabBarController onto the navigation controller's view controller stack, this UITabBarController needs to be initialized with the two view controllers that it is going to display before it gets pushed onto the stack.

Resources