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

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.

Related

Connecting three views to a single navigation controller (XCode 7, Swift 2)

I am unsure of how to link three Views (1 table view, one view that adds data to the table view through core data and one camera view) to the one view controller each with individual buttons.
I've tried to search to find a tutorial for linking views through the storyboard but have found none that help.
If I could have some instructions on to how I can do this (through code or storyboard) that would be much appreciated.
So if I understood it right, you wanna connect three buttons in your storyboard to open different views in storyboard. If yes, you can use this approach: Xcode 4 UIButton segue push to Table View Controller

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"

A Tabbed application with a different Master Detail Table View on each tab, using Core Data

I was hoping someone could help a noobie out.
I am trying to create an iPhone/iPad app that uses tabs as its main navigation. The first tab will be kind of a home screen with basic info and a feedback button etc. The other tabs (3-4 tabs) each need to display a different "section" of the app. Each section will display a table view and navigation controller (using Core Data). These table views are unrelated to each other, each using different tables from the database (sqlite).
To illustrate this lets say tab 1 is the apps Home, tab 2 lists your grocery list, tab 3 lists recipes and tab 4 lists coupons available. They all fit together in the app but they come from completely different tables. Each navigation controller that appears on each tab is Completely different. Im using it like secondary navigation within the tab.
So my question is, does anyone have any tutorials that illustrates this technique? And if not do I have to create a different fetchedResultsController for each tab? I started the project using the Tabbed application template, I then created another dummy project using the master detail template and added the master detail code and xibs to my tabbed project. So I now have tabs that display the generic time stamp entity that comes with the master detail template however I cannot seem to get the tabs to display different data.
Also how can I create a navigation controller for each table view / tab? All of the documentation says to initialize it inside of the AppDelegate however if I put it there how can I get a different controller for each tab? Do I declare 3-4 controllers in the app delegate and some how assign them to each table view? I have not seen an example of this anywhere even though it makes sense. Tutorials would be much appreciated.
Thank you so much in advance. Im just stuck here. :(
So to start off each tab (I assume you're talking about a UITabBarController) will have it's own UINavigationController->UIViewController. I don't know of any tutorials about using the master-detail inside a tab and I haven't done it personally, but for your second question about navigation controllers inside your tab you would do the following:
Start off using a tab template using storyboard.
Inside your storyboard you can see that they have the two view controllers and they are tied in and stuff. I would just delete them as they aren't needed.
From the right side you'll drag in however many UINavigation controllers (the gold ones) you need. When you drag it in it should bring in two views, the controller and the root view.
From the tab bar controller control+drag to the navigation controller and connect it to Relation-view controllers. Do this for all the navigation controllers
Your storyboard should look somewhat like this:
You now have all view structure set up. So you'll now need to create all the classes for those. As you mentioned you'll create a recipe view controller, shopping list view controller...
Set the blank views to use the classes you just created created. From each of these classes you can push views to their navigation controller and it will push it onto that stack and if you switch tabs you'll start where that one left off.
Inside of each of these Classes there will need to be a NSfetchedResultsController that will tie into acore data database (Housed in the delegate or another class) and control that table.
Here is a great tutorial I've used for setting up my first nsfetchedresultscontroller. It goes through the entire process from start to finish.
http://www.raywenderlich.com/999/core-data-tutorial-how-to-use-nsfetchedresultscontroller
I hope that gets you off your stuck phase. let me know if there is anything unclear on the set up.

Can we have more than one view controller in SplitViewController ?

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.

Resources