ios - Custom callouts are all showing on the map after annotation added -



ios - Custom callouts are all showing on the map after annotation added -

i creating custom mkpinannotationview, , after annotation added map view. of them displaying on map. don't want that, want open callout when click on pin , show callout. right code below:

customannotationview.h

@interface customannotationview : mkpinannotationview @property (nonatomic, strong) annotationview *annotationview; @end

customannotationview.m

@implementation customannotationview - (instancetype)initwithannotation:(id<mkannotation>)annotation reuseidentifier:(nsstring *)reuseidentifier { self = [super initwithannotation:annotation reuseidentifier:reuseidentifier]; if (self) { self.annotationview = (annotationview *)[[[nsbundle mainbundle] loadnibnamed:@"annotationview" owner:self options:nil] lastobject]; [self addsubview:self.annotationview]; } homecoming self; }

mapviewcontroller.m

- (void)viewdidload { __weak typeof(self) weakself = self; [[client sharedclient] searchwithparamaters:parameters completionblock:^(nsarray *businesses, nserror *error) { __strong typeof(weakself) strongself = weakself; if (!error) { [strongself.mapview addannotations:businesses]; } }]; } - (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id<mkannotation>)annotation { static nsstring *identifer = @"cell"; customannotationview *pin = (customannotationview *)[mapview dequeuereusableannotationviewwithidentifier:identifer]; if (pin == nil) { pin = [[customannotationview alloc] initwithannotation:annotation reuseidentifier:identifer]; } pin.canshowcallout = yes; pin.animatesdrop = yes; place *place = annotation; pin.annotationview.businesstitle.text = place.name; pin.annotationview.businessdetaillabel.text = place.address; [pin.annotationview.ratingimageview sd_setimagewithurl:[nsurl urlwithstring:place.ratingimagesmallurl]]; homecoming pin; } homecoming nil; }

ios mkmapview mkannotation mkannotationview mkpinannotationview

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -