Unable to set the UILabel of a view Controller from a different view Controller
I am trying to set the text label of a second view controller from the current view controller using the following code:
NSString *loadingString =开发者_如何转开发 [NSString stringWithFormat:@"Loading data from Instahotness....."];
self.loadingPage = [[LoadingPageViewController alloc]init];
self.loadingPage.loadingTextLabel.text = loadingString;
NSLog(@"LoadingPage text: %@",self.loadingPage.loadingTextLabel.text);
When I checked the console, the NSLog
is returning me a <null>
value for the loadingTextLable.text
. Is there something I am doing wrong here? Note that in my LoadingPageViewController
, I hooked up the UILabel
called loadingTextLabel
in my xib.
use initWithNibName to initialize LoadingPageViewController.
精彩评论