我是电话编程的新手。我已经在数组中存储了一些数据,我想将该数组数据从一个视图传递到另一个视图。我尝试了什么但它不起作用。任何人都可以告诉我这是什么错误。
#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>"
)
导入“secondviewcontroller.h”
@property(nonatomic,retain)NSMutableArray *tapCollection1;
@property(nonatomic,retain)NSMutableArray *imageCollection1;
导入“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] (
)
请任何人告诉我这段代码有什么错误谢谢阿斯拉姆