I have this in one view:
-(void)viewWillDisappear:(BOOL)animated
{
RootViewController *rVC = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
[rVC setMessage:[label text]];
NSLog(@"ihere - %@",rVC.message);
}
The NSLog returns the correct string. How would I reload the data in the RootViewController to update the string message there?
doing this doesn’t work in my RootViewController (which i go back to in navcontroller):
-(void)viewWillAppear
{ [[self message] reloadData]; }
because the message is just a string. Can somebody show me how to fix this please?
Hi can someone else try to help me please?
In the viewWillAppear event, i need to reloadData on a NSString. So i need to convert it somehow to an object before i can use reloadData on it.
That’s because NSString doesn’t have a
reloadDatamethod.And as it is immutable it wouldn’t make sense if it did.
What you probably want to do is display your string in
viewWillAppearand change the model property in the controller where it gets this from.Delegation is the usual way to do this and I’ve written a couple of examples that might help you see what is happening;