2011-08-18 17 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のウィンドウには、1つのビューコントローラが必要です。一度に1つのコントローラだけがビューを制御する必要があります。

これが問題になるだろう:

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

[EDIT]実際には、あなたがiPad上でアクティブな2つのView Controllerを持つことができる場合があり、たとえばあなたがポップでビューコントローラを持つことができますアップビュー。

+0

しかし、私はこれを行うことができます別のxib hawで多くのpopoverControllerを使用したいですか? –

+0

それはあなたの質問ですか?あなたは別のxibファイルからUIViewControllerを含むUIPopoverControllerを提示する方法を尋ねていますか?はいの場合は、[この回答](http://stackoverflow.com/questions/5744434/are-there-examples-of-how-to-use-uipopovercontroller-on-ios/5746869#5746869)を参照してください。 – progrmr

関連する問題