Je dispose d'un NSMutabaleArray avec peu de contenu, et que vous voulez copier le contenu d'un autre tableau dans une autre classe, le code:Copier éléments de tableau dans un autre tableau de classe
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]];
la classe avec je veux copier: 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] ;
Lorsque je me connecte le tableau des points, il me donne nulle. Où est le problème, quelqu'un peut me suggérer, merci.
Et je n'utilise pas ARC.
Est-ce que 'sandboxViewController' est défini sur quelque chose lorsque vous faites l'affectation à' points'? – mattjgalloway
oui, connectez également 'sandboxViewController' – MrTJ