在另一个ViewController中导入数组

时间:2012-11-07 10:24:25

标签: xcode arrays

  

可能重复:
  How to pass an array from one view controller to another?

我在firstViewController中有一些数组,我想在第二个视图控制器中使用它。由于我是XCode的新手,我不知道如何做到这一点。 我尝试在第二个视图控制器的viewDidLoad方法中创建firstViewController的对象。然后我试了

在firstViewController中

我创建了5个数组,它们都包含数据,因为我NSLog了它。 现在在SecondViewController.h中

import FirstViewController.h
@property(nonatomic, retain )NSMutablearray *array;

SecondViewController.m     @synthesize数组

-(void) viewDidLoad
 FirstViewController *importArray = [FirstViewController alloc]init];
 importArray.arrayOfFirstViewController = array;
 NSLog(@"%@", array)

但我总是得到null结果。

0 个答案:

没有答案