Stick UISplitViewController in its own XIB? - objective-c

my iPad app starts with a normal UIView showing a login. After the user logged in the screen is supposed to switch to a split view.
XCode's SplitViewTemplate (and all examples on the web I found) however, place UISplitViewController in the main window's xib and define an outlet in the app delegate.
I find that unlogical in my case because I don't need the controller at startup and would like to (following Apple's guidelines) place the split view controller in its own XIB.
Has anybody a working example or a small step by step instruction? I always end up with the XIB not being loaded.
Or is it just NOT possible? But why would it not?
René

You can put a UISplitViewController into a different XIB. You cannot have it be the owner, but you can have your app's delegate be the owner and load it when it removes the login view.
Add UISplitViewController IBOutlet to app delegate
Create a new, empty XIB for iPad
Set the File's Owner to your app delegate class
Add a UISplitViewController, connect to outlet in delegate
Add views to split vew controller
Then, you just have to handle your login in the app delegate, load the new XIB, and display it.

maybe not the answer to your question but I have in my App also a login window. What I do is to put the login view above - in my case - TabBar.

I found this post. Best way to switch between UISplitViewController and other view controllers?
It seems it really is not supposed to work. You have to put it in the main xib and then apply tricks...

Related

UINavigation Controller Root View Change

I recently encountered a small problem with Storyboards. I have a UINavigationController than has a relationship with the MainView RootViewController(This one has all the buttons leading to the rest of my app). However, I tried to change the RootViewController so that I could enable persistent login rather than a UIWebview Login. When I made the new Logon Form ViewController as the Root, the buttons on my MainView simply stop working.
I also have set the UINavigationController as the initial View Controller.
Any ideas on what has to be done here?
I do know that I can simply have the logon screen in the storyboard and call it programmatically, set it to advance on a boolean condition(loginDidSucceed). However, I am confused on why this behavior happens in StoryBoard.
Solution Referred from: Present Splash/Login ViewController With StoryBoard
Thanks for the Help and Effort!
I think the principal problem here is that the target of your butttons is the old view controller instance; when it goes out of scope their target no longer exists.

How to connect a storyboard to a .h and .m

I have in an app a viewController without a .xib, because I want to use with that ViewController a storyboard instead. The problem is that I don't know how to tell Xcode that ViewController2.storyboard is the view of ViewController2.h and ViewController2.m. Anyone knows it?
When you use storyboards, you generally instantiate the view controller inside the storyboard. The big advantage that storyboards have over .xibs is that they model not just the view hierarchy but also the flow from one view controller to the next. So, you'll probably want to either instantiate your view controller in the storyboard where you plan to use it, or else just go back to loading the view from a .xib (which isn't all that different anyway).

iOS 5 storyboard, programmatically determine path

I'm having trouble to achieve the following using a storyboard:
When setup is not done:
run app -> show settings view controller -> show main navigation controller
When setup is done:
run app -> show main navigation controller
So basically, I want the app to programmatically start with the settings view in certain cases, and otherwise skip right ahead to the main navigation controller.
I did manage to show the settings view with a modal style segue from the main navigation controller, but I don't know how to display it before the main navigation controller is displayed. Any ideas?
By default, the initial view controller from your main storyboard is instantiated and displayed automatically when your app starts up. To prevent this happening you need to remove the UIMainStoryboardFile setting from your info.plist file.
With no default view controller, you are now free to create one programmatically at app startup. See the UIStoryboard documentation. Use +storyboardWithName:bundle: to load the storyboard and then use –instantiateViewControllerWithIdentifier: to create the correct view controller. You will also need to create a main UIWindow and add the view controller's view to it just like you used to do with .nib based UI. Note that without the UIMainStoryboardFile setting a main window is not created for you - read the explanation.
I managed to do it a bit different:
Use a UINavigationController as the initial view controller.
Create a root view controller that will manage the decision of what to load.
Create a Storyboard Segues from the root view controller to the main view and to settings view, and give the segues proper identifiers.
Call the performSegueWithIdentifier with the proper identifier from your root view controller.
Just another solution, hope this helps.
I did something similar to amoshaviv, his advice is sound. I did it slightly different though, and I'll give some more info.
I created a custom MyInitialViewController class, derived from UIViewController, and made this the initial view controller.
In the storyboard file, I created modal segues with appropriate names to all (in my case three) possible 'real' first view controllers.
In the MyInitialViewController class, I implemented the
- (void)viewDidAppear:(BOOL)animated;
method, to first perform the check which view to switch to, and then do the correct
[self performSegueWithIdentifier:#"NameOfSegue" sender:self];
Effectively, this makes the MyInitialViewController nothing more than a switch performed when it's brought into view. I first tried doing this when loaded because I don't care for actually seeing this view, but that did not work, while viewDidAppear does.
To make this visually smooth, I tried the following. In the properties of the segues, I disabled animation. The view I left empty, and I gave it a background color matching to that of the startup image.

uiview to uinavigation? app delegate?

So, the app I am working on starts out with a regular view controller (Root View). Upon click of one of the buttons I want a Navigation Controller pushed. Do I need to make the Root View controller the delegate? I've already tried using MyAppsNameAppDelegate as the delegate but it didn't work or I don't know what I'm doing.
Should I start over and follow this suggestion?
loading a UINavigation controller from a UIView
I don't want to do this programmatically either. I'm not ready for that yet.
To speed up your project, I suggest you to start over the project from Navigation-based App instead of View-based App. The Navigation-based App template has wired up things for you by default.

Creating a split view application similar to 'settings' app

I am trying to build an iPad app set-up as a split-view, but on the detail page being able to drill down like a navigation controller.
An example of this working is the setting app on the iPad where if you select the 'General' tab you can then drill down on the detail page from say general > network > VPN
Any help or tips on this would be great. I thought it might be two navigation controllers on the root nib, but couldn't get this working.
you mean like General -> About ->.. (in ipad simulator) right .
if all your detail view needs the TableView, then its better to make your detailviewcontroller as the subclass of UITableViewCOntroller.
OR If you need different views when click on the cells of rootcontroller(left pane)
Create a method in DetailViewController say setDetailView{}. And call this method when click on the cell of RootController
inside this method,
remove all subviews from detailview
create UITableView and set its delegates
on tableview didSelect method, we can push other UIViewController instance
[self.navigationController push...]
Hope it helps.