In one class there is a list with all friends and their IDs. Now when you click on the item in the UITableView the Chat appears ([self performSegueWithIdentifier: @"showChat" sender: self];
). But in the ChatViewController Class I need to access the variable userID from FirstViewController. I tried everything I found on the internet, but it always gives an error or the variable is empty.
In FirstViewController is a NSString userid
, so how can I access this in ChatViewController.m? I tried to make the variable @public
, I tried @property
with readwrite and so on, but it doesn't work.
For example this:
FirstViewController *fvc = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
userID = fvc.userID;
just gives an empty String..
Thanks for help!