iphone - NSMutableArray of ClLocationCoordinate2D -
i'm trying create retrieve array of cllocationcoordinate2d objects, reason array empty.
i have:
nsmutablearray *currentlydisplayedtowers; cllocationcoordinate2d new_coordinate = { currenttowerlocation.latitude, currenttowerlocation.longitude }; [currentlydisplayedtowers addobject:[nsdata datawithbytes:&new_coordinate length:sizeof(new_coordinate)] ];
i've tried adding data:
[currentlydisplayedtowers addobject:[nsvalue value:&new_coordinate withobjctype:@encode(struct cllocationcoordinate2d)] ];
and either way, [currentlydisplayedtowers count] returns zero. ideas might going wrong?
thanks!
to stay in object land, create instances of cllocation
, add mutable array.
cllocation *towerlocation = [[cllocation alloc] initwithlatitude:lat longitude:lon]; [currentdisplayedtowers addobject:towerlocation];
to cllocationcoordinate
struct cllocation
, call coordinate
on object.
cllocationcoordinate2d coord = [[currentdisplayedtowers lastobject] coordinate];
Comments
Post a Comment