0

我在 FirstViewController 类中有一个 NSMutable 数组,我想将该数组传递给 SecondViewController 类。我想在 SecondViewController 类中使用它。我在 Xcode 4.2.1 中使用 ARC 执行此操作...我怎么能...?以及在设置属性时我想使用哪些属性...(或)解释我也使用 Appdelegate 文件...

4

2 回答 2

0

在当前班级

#import "SecondViewController"

 SecondViewController *NextViewController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];

        NextViewController.nextClasssArray = thisClassarray;

在二等舱.h

@property(nonatomic,retain) NSMutableArray *nextClasssArray;

在二等.m

@synthesize nextClasssArray;
于 2012-04-20T07:52:39.007 回答
0

有两种方法可以做到这一点。

1:在appdelegate中为NSMutableArray创建一个属性,在FirstViewController中设置数组的值,在SecondViewController中检索值。

2:在SecondViewController中为NSMutableArray创建一个属性,并为FirstViewController调用该属性但创建SecondViewController的对象,并通过FirstViewController中secondViewController的对象引用调用该属性。

于 2012-04-20T07:52:46.253 回答