in aViewController.h
#import <UIKit/UIKit.h>
@interface aViewController : UIViewController
@property (nonatomic) NSMutableArray *pageImages;
@end
in bViewController.m
#import "aViewController.h"
// ...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger row = indexPath.row;
aViewController *testViewController = [[aViewController alloc] init];
[testViewController.pageImages addObject:@"lalala yeyeye"];
NSLog(@"%@", testViewController.pageImages); // Error?
[self.navigationController pushViewController:testViewController animated:YES];
}
The NSLog in bViewController.m outputs:
2013-10-08 18:23:38.398 quo.mk.e[56804:1ca03] (null)
What did I do wrong here? Why did the NSMutableArray remain empty although I had added an object into it?
Update: both UIViewController objects are made programmatically. I am using the passing data forward tips mentioned here to populate the array, but I'm stumped on why it won't work.