2011-08-18 178 views
0

如何從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 –

回答

0

iPhone上的窗口中應該只有一個視圖控制器。一次只有一個控制器應該控制視圖。

這將是一個問題:

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

[編輯]實際上,存在這樣的情況可以有在iPad活性兩個視點控制器,例如可以在一個彈出有一個視圖控制器up view。

+0

但我想在不同的xib haw中使用許多popoverController我可以做到這一點? –

+0

這是你的問題嗎?你問如何提供一個UIPopoverController從另一個xib文件包含一個UIViewController?如果是,請參閱[這個答案](http://stackoverflow.com/questions/5744434/are-there-examples-of-how-to-use-uipopovercontroller-on-ios/5746869#5746869) – progrmr

相關問題