aViewController.hで
#import <UIKit/UIKit.h>
@interface aViewController : UIViewController
@property (nonatomic) NSMutableArray *pageImages;
@end
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];
}
bViewController.m の NSLog は次を出力します。
2013-10-08 18:23:38.398 quo.mk.e[56804:1ca03] (null)
ここで何が間違っていましたか?オブジェクトを追加したのに NSMutableArray が空のままなのはなぜですか?
更新: UIViewController オブジェクトは両方ともプログラムで作成されます。ここで説明したデータ転送のヒントを使用して配列にデータを入力していますが、それが機能しない理由に困惑しています。