[英]Can't set data to an array in prepareForSegue
我正在使用Objective-C,我想为另一个视图控制器复制一个数组并将其推送。 这是我的代码:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"comment"]){
commentViewController *vc = segue.destinationViewController;
vc.comments = [[NSArray alloc]initWithArray:comments];
}
}
但这是行不通的。 我在Xcode中得到了这个:
2015-12-06 16:27:45.802 net [1244:29117]-[UIViewController setComments:]:无法识别的选择器已发送到实例0x7ff8d34eb720 2015-12-06 16:27:45.807 net [1244:29117] ***终止应用由于未捕获的异常'NSInvalidArgumentException',原因:'-[UIViewController setComments:]:无法识别的选择器发送到实例0x7ff8d34eb720'
有人可以帮我吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.