iphone - MKOverlay order problems -


i have mkmapview 2 overlays: mkpolyline , subclass of mkoverlay defined overlay cllocationcoordinate2d of 0,0 , bounding rect of mkmaprectworld.

i'm trying add mkpolyline overlay , custom overlay afterwards, in response user action. custom overlay needs go under mkpolyline overlay.

i add custom overlay with:

[map insertoverlay:customoverlay atindex:0]; 

however doesn't work. cusomoverlay added on top of existing one. overlay array mkmapview claims ordered correctly though.

the way i've been able enforce correct order remove mkpolyline, add custom overlay , put mkpolyline in.

am missing obvious?

edit code snippets:

the custom overlay class:

@interface transparencyoverlay : nsobject <mkoverlay> {} @end  @implementation transparencyoverlay  - (cllocationcoordinate2d)coordinate {     return cllocationcoordinate2dmake(0, 0); }  - (mkmaprect)boundingmaprect {     return mkmaprectworld; }  @end 

the adding of custom overlay:

- (void)onuseraction {     transparencyoverlay_ = [transparencyoverlay new];     [context_.map insertoverlay:transparencyoverlay_ atindex:0]; } 

the overlay view callback:

- (mkoverlayview *)mapview:(mkmapview *)mapview viewforoverlay:(id <mkoverlay>)overlay {     // if overlay mkoverlay return mkpolylineview     // construction of view kind of complex , can't fit in here     // else:      cllocationcoordinate2d coords[4] = {cllocationcoordinate2dmake(89, 180),                                     cllocationcoordinate2dmake(89, -180),                                     cllocationcoordinate2dmake(-89, -180),                                     cllocationcoordinate2dmake(-89, 180)};     mkpolygon *poly = [mkpolygon polygonwithcoordinates:coords count:4];     mkpolygonview *view = [[mkpolygonview alloc] initwithpolygon:poly];     view.fillcolor = color      return [view autorelease]; } 

the mkpolyline added overlay on viewdidload (again, it's code list here).

did try insertoverlay:aboveoverlay: , nsertoverlay:belowoverlay: methods?


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -