我正在初始化导航控制器并设置根视图控制器。在展示控制器之前,我设置了一个变量。但是,在加载新视图时,该变量为空。我究竟做错了什么?
NSString *email = jsonDict[@"email"];
EmailPopUpViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"EmailPopUp"];
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
CGFloat screenWidth = screenSize.width;
CGFloat screenHeight = screenSize.height;
CGFloat xcoord = (screenHeight - 900) / 2;
CGFloat ycoord = (screenWidth - 640) / 2;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
controller.emailURL = email;
NSLog(@"email: %@", email);
navController.modalPresentationStyle = UIModalPresentationFormSheet;
navController.view.superview.frame = CGRectMake(xcoord, ycoord, 640, 900);
[self presentViewController:navController animated:NO completion:nil];