2012-03-29 51 views
0

我有一个NSMutabaleArray很少内容,并希望将内容复制到另一个阵列中的另一个类中,代码:复印数组元素到另一个类阵列

sandboxcontroller.h:

@interface SandboxViewController : UIViewController 
{ 

NSMutableArray * arrayOfDesc; 
} 

@property (nonatomic, retain) NSMutableArray * arrayOfDesc; 

SandboxContoller .M

@synthesize arrayOfDesc; 

[arrayOfDesc addObject:[[CLLocation alloc] initWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude]]; 

类与我想复制: NVMapViewController.h

@interface NVMapViewController : UIViewController <MKMapViewDelegate> { 
MKMapView *_mapView; 
SandboxViewController * sandboxViewController; 
NSMutableArray * points; 
} 

@property (nonatomic, retain) SandboxViewController *sandboxViewController; 

NVMapViewController.m

points = [[NSMutableArray alloc] initWithArray:sandboxViewController.arrayOfDesc] ; 

当我登录时的点阵列,它给了我零。哪里有问题,谁能建议我,谢谢。

而我不使用ARC。

+1

当你对'points'进行赋值时,'sandboxViewController'实际上是否设置了某些东西? – mattjgalloway 2012-03-29 12:28:50

+0

是的,同样记录'sandboxViewController' – MrTJ 2012-03-29 12:35:36

回答

相关问题