ios - MKMapView region property returning bad struct -
i'm working mkmapkit , setting region full size united states , it's displaying expected. when inspecting self.mapview.region property i'm getting weird results affecting calculations later in program.
here how i'm setting map view:
- (void)viewdidload { [super viewdidload]; mkcoordinateregion usa = mkcoordinateregionmake(cllocationcoordinate2dmake(39.4, -91.5), mkcoordinatespanmake(40, 40)); self.mapview = [[mkmapview alloc] initwithframe:self.view.bounds]; [self.view addsubview:self.mapview]; self.mapview.region = usa; self.mapview.delegate = self; self.mapview.showsuserlocation = yes; [self.mapview.userlocation addobserver:self forkeypath:@"location" options:0 context:nil]; } this usa mkcoordinateregion, looks fine , works:
(lldb) p usa (mkcoordinateregion) $0 = { (cllocationcoordinate2d) center = { (cllocationdegrees) latitude = 39.4 (cllocationdegrees) longitude = -91.5 } (mkcoordinatespan) span = { (cllocationdegrees) latitudedelta = 40 (cllocationdegrees) longitudedelta = 40 } } then set region self.mapview.region = usa; , break after it, output of self.mapview.region.
(lldb) p [self.mapview region] (mkcoordinateregion) $1 = { (cllocationcoordinate2d) center = { (cllocationdegrees) latitude = 39.4 (cllocationdegrees) longitude = 39.4 (cllocationdegrees) latitudedelta = 39.4 (cllocationdegrees) longitudedelta = -91.5 } (mkcoordinatespan) span = { (cllocationdegrees) latitude = 66.4999527377778 (cllocationdegrees) longitude = 66.4999527377778 (cllocationdegrees) latitudedelta = 66.4999527377778 (cllocationdegrees) longitudedelta = 67.4999957172512 } (cllocationcoordinate2d) center = {} } so problem center struct wrong, longitude off , cllocationcoordinate2d shouldn't have delta fields, looks mkcoordinatespan.
cllocationcoordinate2d definition:
typedef struct { cllocationdegrees latitude; cllocationdegrees longitude; } cllocationcoordinate2d;
so idea i'm going wrong? missing blazingly obvious? if wrong way it, how can true data calculations later in app?
using xcode 4.6.1 , ios 6.1 simulator.
i think lldv bug or error in lldb usage. if nslog lat/lon fine.
Comments
Post a Comment