我在songViewController.h
中将数组声明为@property(retain,nonatomic) NSmutableArray allArtist
我在另一个类songdetailsViewController
中使用了这个数组。但它会出现如下错误:use undeclared identifeir 'allArtist'
。
我已导入songViewController.h
songdetailsViewController.h
答案 0 :(得分:0)
首先应该使用指针声明属性:
@property(retain,nonatomic) NSMutableArray *allArtist;
要从songdetailsViewController访问它,您必须在其中设置第二个属性:
@property(retain,nonatomic) NSMutableArray *allArtists;
当你按下视图集时:
UIViewController *songdetailsViewController = [[songdetailsViewController alloc]
initWithNibName:@"songdetailsViewController"
bundle:nil];
songdetailsViewController.allArtists = self.allArtist;
[[self navigationController] pushViewController:songdetailsViewController animated:YES];
最后,您应该考虑将项目移至ARC。