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。
當你對'points'進行賦值時,'sandboxViewController'實際上是否設置了某些東西? – mattjgalloway 2012-03-29 12:28:50
是的,同樣記錄'sandboxViewController' – MrTJ 2012-03-29 12:35:36