Can a splitview be loaded inside the detail view of another splitview? - objective-c

I am trying to develop an application that has screen flow similar to oracle app. I have attached the images here. Can anyone please tell how this can be achieved ?
Thanks in advance.

What you are looking for is a custom Split View Controller. The screenshots you provided are of custom split view controllers. The UIKit has UISplitViewController but this must be a fullscreen view controller.
To make a custom split view controller there's the old way, by having a main view controller and making your two master and detail controllers, adding their view to the main view controllers view.
You need to forward on calls from viewWillAppear:, viewWillDisappear: etc from the main view controller to the two controllers that you manage.
As of iOS 5, you can do something similar with view controller containment, this has a few more bells and whistles, more interesting it handles rotation animations better and all the call forwarding to the children controllers that you had to do manually in the first solution.
Check out this link for more details on custom split view controllers:
http://www.mindtreatstudios.com/how-its-made/custom-uisplitviewcontroller-ios/
To answer your question directly: if you make a custom split view controller - yes you can add this as a detail view controller. But watch out, this isn't a UISplitViewController, so just be careful not to use that term so much.

Haven't really tested this, but doesn't this solve your problem?
Create a storyboard file
Drop in a SplitViewController
Delete the DetailViewController
Drop in another SplitViewController
Link the two together using CTRL-drag and select Detail
Set the size of the detail-splitviewcontroller to Detail
????
Profit!
Anyways, not sure if it really works, but give it a try. This is IOS5 though (I think, might try it out with IB).
It'll look something like this:

If you're going to have to write your own class, you might want to first look at https://github.com/mattgemmell/MGSplitViewController for inspiration.

Related

How to add a bar on top of a UISplitViewController?

I would like to have a separate bar above the UISplitViewController on iPad. I will use this bar to show a logo.
I did some googling and reading but cannot find a solution to this other than create my completely own subclass to draw my screen like I want it. I'd like to avoid that if possible...
You should read about ViewController Containment to build your own Container Controller.
Helpful links:
iOS Reference: https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
objc.io article:
http://www.objc.io/issue-1/containment-view-controller.html
Create your own container view controller. In its view this VC will add a navigation bar (or some other view that you can add your logo to) and the split view controllers view. It should also add the split VC as a child.
This is a custom subclass that you will create, but it is minimal code and requires no drawing code from you.

UISplitViewController - Multiple Detail View Controllers via storyboard segues

I'm trying to do a project for the iPad in which I'd like to utilized the split view controller. I'll be having different detail view controllers for each of the cells in the master view controller.
I saw one solution how to do this via storyboard segues in this site.
He basically linked each of his UITableViewCell to different detail view controllers. But I'd like to know if this is a "stable" or a "good" way of doing this. I mean, is it any better or as stable as doing it programmatically? What would be the consequences of doing his method, if there are any?
Here is the link to the solution I found
This is kind of a tricky one, even though it's an incredibly common use case.
1) One idea is to have an empty root view controller as your detail and it handles managing segues under the hood to quickly segue to the detail view you actually care about, utilizing the "replace" segue. This should "technically" fix having the "back" button at the top left and still allow you to pop to root and not have it show the empty controller. Haven't tested these though, so I'm not sure.
Edit: In Xcode 6, the "replace" segue is conveniently handled by a "show detail" segue which is used specifically for this type of view handling on Split View Controllers. I recommend using this method exclusively in new projects. See sample code.
2) The other idea is to have separate navigation controllers in your storyboard (one connected, the rest all stranded). One for each detail view type and tapping on the master menu will simply swap the navigation controller for the detail view to the one you care about.
Code similar to this in AppDelegate:
self.detailNavigationController = [self.masterNavigationController.storyboard instantiateViewControllerWithIdentifier:#"MyChosenNavigationControllerStoryboardId"];
self.splitViewController.viewControllers = #[self.splitViewController.viewControllers[0], self.detailNavigationController];
self.splitViewController.delegate = (id)self.detailNavigationController.topViewController;
The downside to this second way is that in memory tests, it doesn't appear that swapping a new nav controllers in frees up all of the memory that the old nav controller was using. So it's good to use for simple apps but not for anything crazy complex.

Using one storyboard definition for two view controllers

Is it possible to use one storyboard setup of a view controller with two view controllers?
Situation: I created one view controller's view in my storyboard. This one lets the user add a new data entry. Lets call it MyNewEntryViewController. This works fine. Now I need a way to edit my data entries. For that I'd just like to subclass my first view controller and adapt it where it needs to be. Lets call this one MyEditEntryViewController.
I would load MyNewEntryViewController using instantiateViewController… on my storyboard:
MyNewEntryViewController *newEntryViewController = [storyboard instantiateViewControllerWithIdentifier:#"NewEntryViewController"];
That works great.
What if I want to instantiate my new view controller now? Trying the obvious
MyEditEntryViewController *editEntryViewController = [storyboard instantiateViewControllerWithIdentifier:#"NewEntryViewController"];
results in an MyNewEntryViewController stored in my variable because that's what I had defined in that storyboard.
So, whats the best way to work with my storyboard definition and be able to use two different view controllers? How do you guys do this?
Thanks!
–f
No this is not possible. It is possible to do this with plain old xibs. You can then specify the name of the nib when you initWithNibNamed:bundle: the view controller.
However, I think it's worth taking a step back. Is it really a good idea to do this? Subclassing view controllers can get messy. View controllers are intended to be self contained units of functionality, which is at odds with subclassing. Unless a view controller is specifically designed to be subclassed then I would avoid doing so. I would suggest that you merge the two view controllers and override setEditing:animated:.

Alternative to UISplitViewController without need for it to be rootViewController

I was wondering, I need some simple feature like a UISplitViewController where i have a master-detail navigation. I can't use a UISplitViewController as it requires to be associated as root view controller. I need to have this called modally within a View.
is there any similar alternative controller to implement this?
Thanks guys
Take a look at MGSplitViewController. Really good, offers similar API.

iPad: Split view Controller

I am creating split view based application for iPad.
I have 1) a root view controller 2) a detail view controller
It is like menu and submenu.
Here I am planning to do. I would like to have navigation in root view controller.
It is recomonded to use or not. If it is recomended how is it possible.
There is a function in the Detail View Controller for showing or not showing the popover Button. Possibly you could adapt that in the App Delegate for the whole Detail View Controller? Just go through the source code provided by Apple. It is all well commented.
Not sure what you're asking. If you're asking whether it's recommended to do it like how you describe, then yes, that's the most recommended way to do it.
Root view controller (the smaller left side menu) usually contains the navigation stuff, while the detail view controller (the bigger right side view) contains all the detailed stuff.
You might want to take a look here for a How-To.
Other documents can be found here.