通过 NavC-SWRevealviewController-NavY 将数据从 VC 传递到 VC
Passind data from VC to VC through NavC-SWRevealController-NavC
我在视图控制器之间传递数据时遇到问题
现在,要从 ConversationsVC 打开 Base Chat VC,我使用
UINavigationController *chatNav = (UINavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"chatNav"];
[self.navigationController presentViewController:chatNav animated:YES completion:nil];
其中@"chatNav" 是第一个导航控制器。
我需要将数据从 ConversationsVC 传递到 Base Chat VC,我不知道该怎么做。如果您有任何想法,请帮助我。谢谢!
根本不传递数据。
在您的控制器层次结构之外创建一个对象作为您的数据模型。当您的 ConversationVC 有新数据时,更新您的数据模型。当您的 BaseChatVC 需要数据时,从您的数据模型中读取它。
数据模型的实现取决于数据的复杂性。它可以像 NSUserDefaults
一样简单,也可以像核心数据或服务器存储的包装器一样复杂。
我在视图控制器之间传递数据时遇到问题
现在,要从 ConversationsVC 打开 Base Chat VC,我使用
UINavigationController *chatNav = (UINavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"chatNav"];
[self.navigationController presentViewController:chatNav animated:YES completion:nil];
其中@"chatNav" 是第一个导航控制器。 我需要将数据从 ConversationsVC 传递到 Base Chat VC,我不知道该怎么做。如果您有任何想法,请帮助我。谢谢!
根本不传递数据。
在您的控制器层次结构之外创建一个对象作为您的数据模型。当您的 ConversationVC 有新数据时,更新您的数据模型。当您的 BaseChatVC 需要数据时,从您的数据模型中读取它。
数据模型的实现取决于数据的复杂性。它可以像 NSUserDefaults
一样简单,也可以像核心数据或服务器存储的包装器一样复杂。