在一个课程中,列出了包含所有朋友及其ID的列表。现在,当您单击UITableView中的项目时,会出现“聊天”([self performSegueWithIdentifier: @"showChat" sender: self];
)。但是在ChatViewController类中,我需要从FirstViewController访问变量userID。我尝试了我在互联网上找到的所有内容,但它总是给出错误或变量为空。 在FirstViewController是一个NSString userid
,所以我怎么能在ChatViewController.m中访问这个?我试图使变量@public
,我试图@property
与readwrite等,但它不起作用。 例如对于这一点:将NSString授予其他课程
FirstViewController *fvc = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
userID = fvc.userID;
只是给出了一个空字符串..
感谢您的帮助!