0

How can I receive different values from 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];                 
        }
progrmr
  • 75,956
  • 16
  • 112
  • 147
cs1.6
  • 159
  • 1
  • 2
  • 13

1 Answers1

0

There should be only one view controller in the window on the iPhone. Only one controller should be controlling the view at a time.

This is going to be a problem:

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

[EDIT] Actually, there are cases where you can have two view controllers active on the iPad, for example you can have a view controller in a pop up view.

progrmr
  • 75,956
  • 16
  • 112
  • 147
  • but i want use many popoverController in different xib haw i can do this? – cs1.6 Aug 18 '11 at 03:42
  • Is that your question? Are you asking how to present a UIPopoverController which contains a UIViewController from another xib file? If yes, see [this answer](http://stackoverflow.com/questions/5744434/are-there-examples-of-how-to-use-uipopovercontroller-on-ios/5746869#5746869) – progrmr Aug 18 '11 at 13:14