views:

245

answers:

1

Hi everyone: I'm having a problem making a universal app... In the application delegate I set up the main navigation for ipad and iphone:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
 window = [[UIWindow alloc] initWithFrame:[ [UIScreen mainScreen] bounds]];
 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// The device is an iPad running iPhone 3.2 or later.
  [self putSplitView];
 } else {
  [self putTabBar];
 }
 [window makeKeyAndVisible]; 
 return YES;
}

- (void)putSplitView {
 RootiPadViewController *rootiPadViewController = [[RootiPadViewController alloc] init];
 UISplitViewController *splitController = [[UISplitViewController alloc] init];
 splitController.viewControllers = [NSArray 
        arrayWithObjects:rootiPadViewController.seccionesView,
                         rootiPadViewController.noticiasView, 
                         nil];
    [window addSubview:splitController.view];
}

- (void)putTabBar {
 TabBarController *tabBar = [[TabBarController alloc] init];
 [window addSubview:tabBar.view];
}

RootiPadViewController is in charge of loading data an generating the panes for the splitView, so that its initialization incorporates a modalView with a loader, such that:

@implementation RootiPadViewController

@synthesize seccionesView, noticiasView;

- (id)init {
 if ((self = [super init])) {
  SeccionesVC_iPad *sec = [[SeccionesVC_iPad alloc] init];
  NoticiasVC_iPad *not = [[NoticiasVC_iPad alloc] init];
  self.noticiasView = not;
  self.seccionesView = sec;
  Init *initVC = [[Init alloc] init];
  [self presentModalViewController:initVC animated:YES];
 }
 return self;
}

The code compiles without warnings, but for some reason the loadView method of initVC is never called and the modal view doesn't appear...

Any ideas why this might be happening? thanks for your help!

Antonio

A: 

Maybe you should present your modal ViewController from the RootViewController 'ViewDidLoad' method, instead of the 'init' method... Not sure the view hierarchy is created that soon

VinzzzBarto