2009-08-19 3 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로 전환을 시도했지만 여전히 운이 없다. 희망이 있다면 도움이 될 것이다. 왜냐하면 이것이 내가 가장 잘 할 수있는 해결책 인 것 같아. –

관련 문제