将参数传递给导航控制器的根目录

时间:2013-10-24 13:48:13

标签: ios uinavigationcontroller

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

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

1 个答案:

答案 0 :(得分:0)

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