Can we have more than one view controller in SplitViewController ? - ipad

I am just starting with iPad App development. I want to use splitViewController in my app. I have gone through various tutorials and references about the same. In all of those I mainly see all we have is one masterViewController and one detailViewController. Content of detailView are loaded based on row selected in masterViewController.
my question is it possible to have different in an app viewcontrollers and those will be loaded on the click on respective row selection in masterViewController. If So should I have to initialized splitviewController in appdelegate only one of those or is there any other way to do this ? Please help me out.
Regards,
Sumit

I think It's what you are looking for : it's a sample of code made by Apple
The application uses a split view controller with a table view controller as the root view controller. When you make a selection in the table view, a new view controller is created and set as the split view controller's second view controller.
Do not hesitate to ask for more details.

Related

Master Detail View I would like to segue back to master view rather than detail view

I have created a master-detail view and from the detail view I have created segues to various view controllers.
When I tap on one of the view controllers the user is returned to the detail view but I would like to return directly to the master view, where the table is shown.
I have looked at previous posts on this but either do not understand them or they do not work for me.
e.g. Someone wrote writing "self.preferredDisplayMode = .AllVisible" but if that is an answer I cannot see where I would write the code.
Sounds like what you are looking for is an Unwind Segue, where you set the master view controller as the destination from wherever the user is sitting in the view controller hierarchy.
Here is a tutorial from another frequent StackOverflow contributor that might help you out.
I decided there is no satisfactory way to do this

iOS - UISplitViewController in storyboard - multiple master views and multiple detail views

I am developing a new iPad application . I end up with multiple master as well as multiple detail.
I searched the stackoverflow and found the same article : iOS - UISplitViewController with storyboard - multiple master views and multiple detail views
Since I am a new user, I can not comment on the same article.
My question is where should I put the UISplitViewController in storyboard?
As per the above article , "(1)Navigation Controller -> (2) table view of 6 menu options -> (3) Each cell in the table pushes a different table view controller onto the navigation stack."
should I put split view controller here before (3) or it will go somewhere else?
I am new to ios development, any help will be appreciated.
Please refer following link:
uisplitviewcontroller
From my experience, you should place split view controller at first place, as master detail are going to embedded in UINavigationController.

How to find the name of the view controller beneath a popover ios7

This is probably a very simple question but I can't find the answer to it.
I am working on a new project that uses Storyboards for the first time.
I have a number of view controllers that connect the way I want them to.
Each view controller has an info button.
I have one view controller (AboutViewController) that I want to use to display the info for all the view controllers. I am currently calling this via a popover segue from each screen. So I have one destination view controller (AVC) that I am calling from a number of VCs- VC1toAVC, VC2toAVC, VC3toAVC etc. I want two textfields in AVC to change, depending on which VC called it.
So here's the problem- how can I tell which view controller called the popup? It's basically the view that's below the popover. Currently I'm storing it as a variable but that's not ideal. I'm guessing it has something to do with the segue identifiers?
Any and all help much appreciated!
One approach to this is adding a property to your pop up view controller and then define the
prepareForSegue:sender:
method so you set your destination view controller's property to the sender of the segue.

iPad master detail app - change detail view controller's content

I started to explore the UISplitViewController class with a new master detail project in XCode, and I would like to replace the detail view's content with another UIViewControllers. I wrote it in this way (self is the detail viewcontroller and controller is the uiviewcontroller which I want to replace the first one with):
self.view = controller.view;
My question is: is it a proper way, will Apple accept it? If it is not, how could I do it better?
I am also building an iPad app with Master - Detail View Controllers in a UIIntelligentSplitViewController. As UISplitViewController doesn't support well while changing to different orientations, using UIIntelligentSplitViewController solves the issue with orientation change. See more here.
I have read on one of apple documentation and also a in best practices that we should use Only one MasterView and DetailView Controllers in entire app, and write code in such a way that all data are loaded in these two views according to the object selected.
But loading all data in same detail view might be a lot of code. So, I am also in search for answer for efficiently writing code to load in same detail view controller. However currently I am implementing only two views to show net data.
If there is any other efficient way to accomplish it, please do mention. Thanks.
You could replace the detail view controller where it is setup in your app delegate "didFinishLaunchingWithOptionsMethod". Your method would probably also work but is creating unnecessary overhead. The auto generated code they provide default's to a navigation controller on the left and a view controller on the right but you can change that to whatever you need. I have a project where I have two navigation controllers.

UISplitViewController on iPad with Storyboards?

In Xcode, how can I create a simple iPad application that uses Storyboards such that the DetailView controller is swapped out for each entry? Most examples that I've seen use the iPhone or they simply change the values in the same detail view controller.
I want to create the segues in Interface Builder from a static TableView Controller (with say 3 rows) where each row will load a different game detail view controller, which I would drag out and design in IB. Currently, when I connect a view controller with a segue, it replaces the navigation part of the UISplitViewController. In other words, it's like I'm traversing a tree, and I need to tell IB that I'm at a root node and I should be changing the Detail View.
A good starting point for segues are Lectures 6 and 7 of Stanford's CS193p Fall 2011 class.
http://itunes.apple.com/us/itunes-u/ipad-iphone-application-development/id473757255
The instructor, Paul Hegarty, covers everything. However, he runs out of time before the end of class to answer this question. He does include the source with the final solution in the file: Psychologist with Dr Pill.zip.
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall
Basically, all that needs to be done for this question is to Ctrl-drag from each UITableCell to the respective game detail view controllers then select the Replace segue. There is one more step because the view controller will shrink because by default Xcode thinks that you want to replace the master controller. For each of the segues, select the connection line and in the Attributes inspector then change the Destination from "Master Split" to "Detail Split". At this point, you can test with the popover, without writing any code.
Apple has provided sample code of a more general solution to the problem of how to swap out different detail views based on what is selected in the master view. The Apple example code accomplishes this by introducing a custom implementation of the UISplitViewControllerDelegate protocol:
https://developer.apple.com/library/ios/samplecode/MultipleDetailViews/Introduction/Intro.html
Hard to describe without pictures but: have a navigation controller as the master. Then hang each detailview off this with a named segue that replaces.
Then you need a bit of code.
In you master viewcontroller inside didSelectRowAtIndexPath, you need a switch statement based on indexpath.row and in each row call detailview performSegueWithIdentifier:#"the row you want"

Resources