0

UITableViewControllerUINavigationController을 프로그래밍 방식으로 표시하려고합니다. 그러나 탐색 컨트롤러없이 표시됩니다. 이 문제를 어떻게 해결할 수 있습니까?UINavigationController로 포함 된 UITableViewController로 이동

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

MyTableViewController *myt = [self.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"mytableviewControllerID"]; 
     UINavigationController *nav = ((UINavigationController*)myt); 

     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

     self.window.rootViewController = nav; 
     [self.window makeKeyAndVisible]; 

return YES; 

} 

답변

1

당신의 실수가 탐색 컨트롤러에서 컨트롤러를 포함하지 않는

UINavigationController *nav = ((UINavigationController*)myt); 

이를하고있다. 컨트롤러를 네비게이션 컨트롤러로 보내고 있습니다.

이 시도 :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

MyTableViewController *myt = [self.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"mytableviewControllerID"]; 
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:myt]; 

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
self.window.rootViewController = nav; 
[self.window makeKeyAndVisible]; 

return YES; 

} 
관련 문제