ios - Drop Pin in MapView using Custom Addresses -
i created map view in app. want user able add several addresses drop pins @ locations. want user able remove these pins.
does know can find tutorial, or start? have no experience mapviews...
try this......
-
(void)showpins { activity.hidden=yes; [activity stopanimating]; double lat; double lng; (int ijk=0; ijk<arraylocationlist.count; ijk++) { /*set lat , long here*/ lat=[[[[arraylocationlist objectatindex:ijk]objectforkey:@"location"] objectforkey:@"lat"] doublevalue]; lng=[[[[arraylocationlist objectatindex:ijk]objectforkey:@"location"] objectforkey:@"lng"] doublevalue]; cllocationcoordinate2d geos = cllocationcoordinate2dmake(lat, lng); mkplacemark* marker = [[mkplacemark alloc] initwithcoordinate:geos addressdictionary:nil]; [mapvieww addannotation:marker]; } cllocationcoordinate2d coord1 = {.latitude = lat, .longitude =lng}; mkcoordinatespan span = {.latitudedelta = .03,.longitudedelta = .03}; mkcoordinateregion region = {coord1, span}; [mapvieww setregion:region]; } - (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>)annotation; { mkpinannotationview *newannotation = [[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@"annotation1"]; uilabel *lable=[[uilabel alloc]init]; [newannotation addsubview:lable]; newannotation.pincolor = mkpinannotationcolorred; newannotation.animatesdrop = yes; newannotation.canshowcallout = no; [newannotation setselected:yes animated:yes]; return newannotation; }
Comments
Post a Comment