Hey,
I had same trouble, and didn't like nobody helped me. So I will post my solutionSo u can keep happy coding ^_-
In ur appDelegateCode:- (void)applicationDidFinishLaunching:(UIApplication *)application {
-->
Code:LoginScreenController *modalLoginView = [[[LoginScreenController alloc] initWithNibName:@"LoginScreenController" bundle:nil] autorelease]; [modalLoginView setModalPresentationStyle:UIModalPresentationFullScreen]; [self.splitViewController presentModalViewController:modalLoginView animated:NO];
BEFORE theCode:[window makeKeyAndVisible];
Don't forget to import the "LoginScreenController.h" at top
Good luck
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog(@"applicationDidFinishLaunchingWithOptions");
//--Copy database to the user's phone if needed.
[self copyDatabaseIfNeeded];
//--Initialize the login array.
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
self.loginArray = tempArray;
[tempArray release];
//--Once the db is copied, get the initial data to display on the screen.
[Login getInitialDataToDisplay:[self getDBPath]];
// Configure and show the window
LoginDBMainViewController *modalLoginView = [[[LoginDBMainViewController alloc] initWithNibName:@"LoginDBMainViewController" bundle:nil] autorelease];
[modalLoginView setModalPresentationStyle:UIModalPresentationFullScreen];
[self.splitViewController presentModalViewController:modalLoginView animated:NO];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
// Override point for customization after application launch.
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
return YES;
}
LoginDBMainViewController *modalLoginView = [[[LoginDBMainViewController alloc] initWithNibName:@"LoginDBMainViewController" bundle:nil] autorelease];
[modalLoginView setModalPresentationStyle:UIModalPresentationFullScreen];
[self.splitViewController presentModalViewController:modalLoginView animated:NO];
[window addSubview:[navigationController view]];
First of all, I have no experience in Storyboarding, so not sure if that's the same flow or not.. But I think the error lies here
Code:LoginDBMainViewController *modalLoginView = [[[LoginDBMainViewController alloc] initWithNibName:@"LoginDBMainViewController" bundle:nil] autorelease]; [modalLoginView setModalPresentationStyle:UIModalPresentationFullScreen]; [self.splitViewController presentModalViewController:modalLoginView animated:NO]; [window addSubview:[navigationController view]];
You show a modal ViewController, and AFTER you add a subview, which will means, it will add it on top of the modal, so I think the error is there!
Good luck
Greets, Noxx
// Override point for customization after application launch.
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
Check if all your pointers are okay, and also put this block
before the window keyvisible thing ^_-Code:// Override point for customization after application launch. UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; splitViewController.delegate = (id)navigationController.topViewController;
Also, I don't think that's the best way to do it (or if it's changed like that in storyboard, no problem.)
Like you implied yourself, we had MainWindow.xib (pre xcode 4.2), so I have absolutely no idea how to help you out, I think users like Dejo, Balanw, Firewood, Art are the persons you are looking for to help you for this solution, since I haven't taken the step towards Storyboards, and don't want to feed you wrong information, or let you make spaghetti code
Maybe another hunt at google?