2012-03-29 9 views
0

ich eine NSMutabaleArray mit wenige Inhalt habe, und wollen Sie den Inhalt in ein anderen Array in einer anderen Klasse kopieren, den Code:Copy-Array-Elemente in einer anderen Klasse Array

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]]; 

die Klasse mit i kopieren möchten: NVMapViewController.h

NVMapViewController.m

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

Wenn ich die Punkte Array einzuloggen, es gibt mir null. Wo ist das Problem, kann mir jemand vorschlagen, danke.

Und ich benutze nicht ARC.

+1

Ist 'sandboxViewController' tatsächlich auf etwas gesetzt, wenn Sie die Zuweisung zu' points' vornehmen? – mattjgalloway

+0

ja, log 'sandboxViewController' auch – MrTJ

Antwort