Passing array to a segue

馋奶兔 提交于 2019-12-25 04:14:05

问题


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];
}

I've declared BArray as property in BViewCOntroller:

  @property (retain) NSMutableArray *BArray;

and synthesized it....

and the error is

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

where am i wrong? Thank you in advance,


回答1:


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



来源:https://stackoverflow.com/questions/10147500/passing-array-to-a-segue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!