Today I use MVC to build a photo album.But I can't get data in ViewControllerB that pass from ViewControllerA,I read this article here is link (Passing Data between View Controllers), and check all the steps I do.
Here is code in ViewControllerA
:
PhotoViewController *photoVC = [[PhotoViewController alloc] initWithNibName:nil bundle:nil];
photoVC.images = images;
photoVC.index = index;
photoVC.view.backgroundColor = [UIColor lightGrayColor];
[self presentViewController:photoVC animated:YES completion:^{
// code
}];
Here is code in ViewControllerB
:
@interface PhotoViewController : UIViewController
@property (nonatomic ,retain) NSMutableArray *images;
@property (nonatomic, assign) NSInteger index;
@end
here is .m file
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%@", self.images);
}
But I got nothing, I don't know where I was wrong, how to make it right?? Thanks a lot.