问题
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