電話プログラミングは初めてです.配列データをあるビューから別のビューに渡したいデータを配列に保存しています.
#import"firstviewcontroller.h"
@property(nonatomic,retain)NSMutableArray *tapCollection;
@property(nonatomic,retain)NSMutableArray *imageCollection;
#import"firstviewcontroller.m"
@synthesize imageCollection,tapCollection;
-(void)viewdidload
{
self.tapCollection = [[NSMutableArray alloc] init];
self.imageCollection = [[NSMutableArray alloc] init];
}
- (void)insertNewObject:(id)sender
{
secondviewcontroller*r= [[secondviewcontrolleralloc] initWithNibName:@"secondviewcontroller" bundle:nil];
self.navigationController.navigationBar.tintColor=[UIColor blackColor];
r.imageCollection1 =imageCollection;
r.tapCollection1 =tapCollection;
[self.navigationController pushViewController:r animated:YES];
}
実際、配列に保存するデータは画像とボタンタグの値です。ここでは、コンソールに表示されている画像とボタンタグの値を配列に保存しています
2013-03-19 21:54:03.374 Taukyy[290:1c103] (
0,
"<UIImage: 0x9cd59e0>",
1,
"<UIImage: 0x9cd6220>",
2,
"<UIImage: 0x9cd6b70>"
)
import"secondviewcontroller.h"
@property(nonatomic,retain)NSMutableArray *tapCollection1;
@property(nonatomic,retain)NSMutableArray *imageCollection1;
import"secondviewcontroller.m"
@synthesize tapCollection1,imageCollection1;
- (void)viewDidLoad
{
imageCollection1 = [[NSMutableArray alloc] init];
tapCollection1 = [[NSMutableArray alloc] init];
NSLog(@"%@",tapCollection1);
NSLog(@"%@",imageCollection1);
}
しかし、ここでは値が表示されていません。以下のように表示されます
2013-03-19 21:29:16.379 Taukyy[594:1c103] (
)
2013-03-19 21:29:16.380 Taukyy[594:1c103] (
)
2013-03-19 21:29:16.381 Taukyy[594:1c103] (
)
このコードの間違いを教えてください ありがとうアスラム