Navigation between view controllers in master-detail application - ios

I am new to IOS development. I am developing small application using master-detail application template. The navigation model I am trying to achieve for my app is the following:
before going to split view controller I would like to have view controller where user can make some choices. In that view controller I have few buttons. I can achieve this for iPhone app, but I have not idea how to implement this for iPad app. For iPad when I add navigation view controller and view controller before split view controller I get an error.
My question is: is it possible to add view controller before split view controller in master-detail application (for iPad), or there is another solution for implementing such kind navigation?

Due to Apple's guidlines, the UISplitViewController must be the root view controller for your application. If you want to have other views on top of this view, you must present them modally. This SO question should start you down the right path in doing that.

Related

Creating a custom navigation controller that controls two views

So I am creating an app for iPhone and iPad. I am currently working on the iPhone version. I need to implement a custom navigation controller that controls only both view controllers that are on the screen. It's better to demonstrate the situation with a few pictures.
So what I want to do is have a navigation controller that can control both of my view controllers and I can push a new view controller on the bottom or on the top with the other staying as it is. I have no problem with doing the basic code like pushing a new view controller, animating the transition etc. What I am asking is more about the "correct way" of making this. Also how can I link the IBOutlets in navigation controller to the custom view controllers in Xcode, if I try to drag it to my view controller, it won't let me, I think it's because they're in different groups(see picture 2). Is there any way to do this?

Multiple Push Segues to One View Controller in Storyboard

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.

IPad Split View Implement in Another View

I am creating a iPad App and it has several views to load data,but for one view i need to add split view. I dont need split views in other views. They are just detail pages. I search Through the net and found lots of tutorials based on iPad split view. But the problem is they all are creating a project as Split view project or they create a window base app and add slipt view to the delegate. I dont need to do that, I need to implement this split view only for one view. Is There any way to overcome this problem?
You can add the split view inside a Navigation Controller.
Even if the Split View is a container view controller and Apple recommends in the documentation that all containers should not be embedded in other containers, adding a split view inside a navigation controller works correctly and I never noticed any side effect in doing it.
Basically what you should do is:
- in the app delegate create a UINavigationController and use it as root view of your application window
- hide the navigation controller navigation bar if you don't want to see it (showing a split view with a main navbar on top is not nice looking...)
- then add your view controllers inside the navigation bar.
Example: imagine you have this application views sequence:
FIRST VIEW (full view = detail page)
SECOND VIEW (split view)
THIRD VIEW (full = detail page)
So you can represent FIRST and THIRD as standard view controllers (full screen), while SECOND will be a split view. Your app will be initialized by creating the main navigation controller, adding FIRST on it as top controller and using the main navigation controller as window's root view.
Than use the navigation controller push, pop methods to switch between these views or change the navigation controller "viewControllers" array directly if you don't want the recommended push/pop methods.
If you need to add special behavior to the navigation controller based on the type of view on top, just register your app delegate as navigation controller delegate (or a "main controller" object dedicated to this if you don't want to complicate your app delegate).
I am not 100% sure, but it seems to me that you can't use a SplitView just somewhere in your view hierarchy.
The Apple intended way is to use the SplitViewController as the top level controller. The left side of it can include a drill down mechanism with a navigation controller so you are ably to drill down hierarchies and the right side will present details for the item you select on the left side.
If you need a view with some kind of split mechanism in it, you probably have to code it yourself. Or even better: find some other mechanism you can use in your UI.
How are you switching your view hierarchies now? Maybe you could integrate your existing UI into a SplitViewController?

Is it ok to have two Table Views on the same window/view as master-detail concept on iPad?

I have a UITabBar in my iPad app, and I need to have a Master-Detail concept on one of my UITabBarviews.
I can't use UISplitViewController because Apple says:
The split view controller’s view should always be installed as the root view
of your application window. You should never present a split view inside of
a navigation or tab bar interface.
Is it ok to have two UITableViews on same view as Master-Detail concept on iPad? Is there any other approach for this idea?
I don't know of any limitation about having two table views in a tab. I'd approach it like this:
for that tab, have an overall UIViewController that can run things when the user switches to that tab
it sets up the master detail table views as appropriate.

Can I move from a login View to a SplitView in an iPad application?

Hope there is not an answer yet (I've checked). Can I introduce a login View in my application that enables a SplitView by using a button or something?
I've checked MGSplitViewController, but I'd like to use something more light and minimal.
If it's not possible, can I introduce a login View in my DetaiView that enables a TableView?
You can transition between arbitrary view controllers in iOS. The usual ways are using modal presentation (I like to present splash screens with a cross-dissolve animation to the root view controller of the app), or pushing/popping with navigation controllers. You can also programatically swap between multiple views in a view controller via setting the "view" property.

Resources