This way the text isn’t showing upp
ClubViewController *cvc = [[ClubViewController alloc] init];
cvc.title = [self wordAtIndexPath:indexPath];
NSString * temp = [[DataManager getSharedInstance] getClubInfo:cvc.title onCountry:self.countryName];
[[cvc info] setText:temp];
[self.navigationController pushViewController:cvc animated:YES];
[cvc release]
This way it does.
ClubViewController *cvc = [[ClubViewController alloc] init];
[self.navigationController pushViewController:cvc animated:YES];
cvc.title = [self wordAtIndexPath:indexPath];
NSString * temp = [[DataManager getSharedInstance] getClubInfo:cvc.title onCountry:self.countryName];
[[cvc info] setText:temp];
[cvc release]
Why?
This is because the XIB file isn’t loaded yet. It gets loaded as soon as the view controller is pushed onto the navigation controller. Prior to the view being loaded and the outlets being set
cvc.infowould be pointing tonil. So calling[cvc.info setText:temp];would do nothing.But in the second case, the outlet is set. So the same
[cvc.info setText:temp];has a meaning and the text is set in the view.EDIT
Just to add, the right way to go would be to create a property to store your value and setting the text for the text field in
viewWillAppear:orviewDidLoadlike others have opined in the comments.