2013-10-24 35 views
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]; 
+1

你設置屬性爲**非原子**和** **強的'emailURL'? –

回答

0

我不小心設置emailURL弱的財產......其更改爲強解決問題

相關問題