如何从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 :(得分:0)
iPhone上的窗口中应该只有一个视图控制器。一次只能有一个控制器控制视图。
这将是一个问题:
[self.window addSubview:viewController2.view];
[self.window addSubview:viewController.view];
[编辑]实际上,有些情况下你可以在iPad上激活两个视图控制器,例如你可以在弹出视图中有一个视图控制器。