0

我正在初始化导航控制器并设置根视图控制器。在展示控制器之前,我设置了一个变量。但是,在加载新视图时,该变量为空。我究竟做错了什么?

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];
4

1 回答 1

0

我不小心将 emailURL 的属性设置为 weak... 将其更改为 strong 解决了问题

于 2013-10-24T13:57:12.327 回答