2009-08-19 8 views

答えて

0

flipsideにUINavigationControllerのサブクラスを表示させることができます。

または、新しいビューコントローラをプッシュ/ポップする必要なくナビゲーションバーが必要な場合は、NIBからフリップサイドビューが読み込まれているので、NIBファイルにナビゲーションバーを追加するだけです。

0

アプリケーションデリゲートのヘッダファイル(MyAppDelegate.h):

@interface MyAppDelegate : NSObject <UIApplicationDelegate> { 

    IBOutlet UIWindow *window; 
    // We're assuming the root view for the main view is connected to this outlet of the app delegate 
    // It'll probably have a different class than UIViewController in your app 
    IBOutlet UIViewController *mainViewController; 
    UINavigationController *settingsNavigationController; 
} 

// Other view controllers can do [(MyAppDelegate *)[UIApplication sharedApplication].delegate showSettings] to show the settings 
- (void)showSettings; 
- (void)hideSettings; 

@end 

アプリケーションデリゲートの.mファイル(MyAppDelegate.m):

- (void)showSettings 
{ 
    // Load the settings view controller the first time it's needed 
    // We're assuming you created the root view controller for the settings in a nib called SettingsRootViewController.xib. You might also just create the root view programmatically (maybe by subclassing UITableViewController) 
    if(settingsNavigationController == nil) 
    { 
     SettingsRootViewController *settingsRootViewController = [[[SettingsRootViewController alloc] initWithNibName:@"SettingsRootViewController" bundle:nil] autorelease]; 
     settingsNavigationController = [[UINavigationController alloc] initWithRootViewController:settingsRootViewController]; 
     settingsNavigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal 
    } 

    [rootViewController presentModalViewController:settingsNavigationController animated:YES]; 
} 

- (void)hideSettings 
{ 
    [settingsNavigationController dismissModalViewController:YES]; 
} 
+0

は本当に素晴らしい解決策のように思えます!しかし、私はそれを動作させるトラブルを抱えています。 'rootViewController'とは何ですか?私はそれがルートのビューコントローラであるとは思いますが、何とか最初に実装されるべきではないでしょうか?そして、私はあなたのようなメソッドを '[(MyAppDelegate *)[UIApplication sharedApplication] .delegate showSettings]'と書いて問題を抱えています。私はUIApplication.sharedApplication.delegate.showSettingsでそれを切り替えようとしましたが、まだ運が無ければ...あなたが助けてくれることを願っています。 –

関連する問題