将数组传递给segue [英] Passing array to a segue

查看:60
本文介绍了将数组传递给segue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数组从视图A传递到segue B,这是代码:

I'm trying to pass an array from view A to segue B, here's the code:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"B"]) {
        BViewController *B = [segue destinationViewController];
        [B setBArray:self.AArray];
}

我已经在BViewCOntroller中将BArray声明为属性:

I've declared BArray as property in BViewCOntroller:

  @property (retain) NSMutableArray *BArray;

合成它....

错误是

NSInvalidArgumentException', reason: '-[UINavigationController setBArray:]: unrecognized selector sent to instance...

我在哪里错?预先谢谢您,

where am i wrong? Thank you in advance,

推荐答案

destinationViewController返回的是UINavigationController,而不是BViewController.您是否正在寻找新的UINavigationController?可能是故事板上的一个错误.

The destinationViewController is returning a UINavigationController, not a BViewController. Are you segueing to a new UINavigationController? May be a mistake in your storyboard.

这篇关于将数组传递给segue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆