2011-08-04 6 views
1

MGSplitViewControllerを使用する必要があるのは、マスタービューコントローラをポートレートモードで表示できるからです。しかし、スプリットビューを表示する前に、ログイン画面を表示する必要があります。残念ながら、起動時にView Controllerを呼び出す方法がいくつかあるので、View Controllerをフルスクリーンでポップできません。以下は、私のアプリケーションデリゲートと詳細ビューのコントローラコードです。セレクタメソッドは私がモーダルを開くのを妨げることに注意してください!MGSplitViewControllerがルートではない

AppDelegate.hは他すべてが標準であるMGSplitViewControllerAppDelegate.h

// RandomStringAppDelegate.m 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    // Override point for customization after app launch. 
    // Set the split view controller as the window's root view controller and display. 
    //self.window.rootViewController = self.splitViewController; 
    // Add the split view controller's view to the window and display. 

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; 
    [prefs setObject:@"YES" forKey:@"FirstRun"]; 


    [window addSubview:splitViewController.view]; 

    [window makeKeyAndVisible]; 


    [rootViewController performSelector:@selector(selectFirstRow) withObject:nil afterDelay:0]; 
    [splitViewController performSelector:@selector(toggleMasterView:) withObject:nil afterDelay:0]; 
    [detailViewController performSelector:@selector(configureView) withObject:nil afterDelay:0]; 

    //[self.window makeKeyAndVisible]; 

    return YES; 
} 

用いて構築されました! 残念ながら、私はここでモーダルをポップすることはできません。

答えて

0

MGSplitViewControllerからクラスを派生させ、そのクラスのviewDidLoadまたはviewWillAppear:であなたのことを処理できます。したがって、あなたのprefsキー "FirstRun"を追跡でき、 "YES"に設定されていると、viewDidLoadでモーダルを開始している間にsplitviewが非表示になります。私はこれが仕事をすることができると思う。上のコードで[prefs synchronize]が不足しているので、キーを書き戻せません。

関連する問題