添加许多视图控制器

问题描述:

如何从appDelegate接收不同的值?添加许多视图控制器

@synthesize window; 
@synthesize viewController; 
@synthesize viewController2; 

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

    [self.window addSubview:viewController2.view]; 
    [self.window addSubview:viewController.view]; 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
     if (choix==6) { 
      XMLTestAppDelegate *appDelegatess = (BroseFormular2*)[[UIApplication sharedApplication] delegate]; 
      appDelegatess.viewController2.detailItem =[listOfMovies objectAtIndex:indexPath.row]; 
     } 
     else if (choix==7)    
     { 
      XMLTestAppDelegate *appDelegate = (BroseFormular2*)[[UIApplication sharedApplication] delegate]; 
      appDelegate.viewController2.detailItem =[listOfMovies objectAtIndex:indexPath.row]; 
     }   
     else {    
      NSLog(@"no"); 
      XMLTestAppDelegate *appDelegates = (authe*)[[UIApplication sharedApplication] delegate]; 
      appDelegates.viewController.detailItem =[listOfMovies objectAtIndex:indexPath.row];     
     } 
+0

你问iPhone,iPad或Mac吗? – progrmr

+0

我问ipad –

iPhone上的窗口中应该只有一个视图控制器。一次只有一个控制器应该控制视图。

这将是一个问题:

[self.window addSubview:viewController2.view]; 
[self.window addSubview:viewController.view]; 

[编辑]实际上,存在这样的情况可以有在iPad活性两个视点控制器,例如可以在一个弹出有一个视图控制器up view。

+0

但我想在不同的xib haw中使用许多popoverController我可以做到这一点? –

+0

这是你的问题吗?你问如何提供一个UIPopoverController从另一个xib文件包含一个UIViewController?如果是,请参阅[这个答案](http://*.com/questions/5744434/are-there-examples-of-how-to-use-uipopovercontroller-on-ios/5746869#5746869) – progrmr