ios - MKMapview change annotation image -


- (mkannotationview *)mapview:(mkmapview *)mv viewforannotation:(id<mkannotation>)annotation {     nslog(@"annotion");      cgsize imgsize;     mkannotationview *pinview = nil;     static nsstring *defaultpinid = @"pin";     pinview = (mkannotationview *)     [self.m_mapview dequeuereusableannotationviewwithidentifier:defaultpinid];      pinview = [[mkannotationview alloc] initwithannotation:annotation reuseidentifier:defaultpinid];     pinview.canshowcallout = no;     pinview.image = [uiimage imagename:@"blue.jpg"];      return pinview; }       - (void)mapview:(mkmapview *)mapview didselectannotationview:(mkannotationview *)view{     view.image = [uiimage imagename:@"orange.jpg"] } 

i added annotations on mapview image(i.e blue image).when tap annotation changed image (i.e. orange image). tap on annotation change annotation(i.e.orange image) (i.e blue image) , change selected annotation (i.e.orange image).any appricated.thanks in advance

try this, may helpful.

reload other annotations.

- (void)mapview:(mkmapview *)mapview didselectannotationview (mkannotationview *)view{      (id<mkannotation> annotation in mapview.annotations){         mkannotationview* anview = [mapview viewforannotation: annotation];         if (anview){             anview.image = [uiimage imagename:@"blue.jpg"];          }      }      view.image = [uiimage imagename:@"orange.jpg"]; } 

try


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -