大佬教程收集整理的这篇文章主要介绍了iOS mapView – 只需轻按一下即可拖动图钉,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
//Custom pin on mapview -(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)Annotation { MKAnnotationView *MyPin=[[MKAnnotationView alloc] initWithAnnotation:Annotation reusEIDentifier:@"current"]; MyPin.draggable = YES; //Get Annotaion title to determine what image to use MKPointAnnotation *AnnotationPoint = [[MKPointAnnotation alloc]init]; AnnotationPoint = Annotation; if([AnnotationPoint.title isEqualToString:@"user"]) { MyPin.image = [UIImage imagenamed:@"userLOCATIOn_pin"]; MyPin.centerOffset = CGPointMake(-13,-5); //Offset custom image to display at the exact pin point GPointMake([left/right],[up/down]); } else if ([AnnotationPoint.title isEqualToString:@"desTination"]) { MyPin.image = [UIImage imagenamed:@"desTination_pin_up"]; MyPin.centerOffset = CGPointMake(-13,[up/down]); } return MyPin; }
//Custom pin on mapview -(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)Annotation { MKAnnotationView *MyPin=[[MKAnnotationView alloc] initWithAnnotation:Annotation reusEIDentifier:@"current"]; MyPin.draggable = YES; //Get Annotaion title to determine what image to use MKPointAnnotation *AnnotationPoint = [[MKPointAnnotation alloc]init]; AnnotationPoint = Annotation; if([AnnotationPoint.title isEqualToString:@"user"]) { MyPin.image = [UIImage imagenamed:@"userLOCATIOn_pin"]; MyPin.centerOffset = CGPointMake(-13,[up/down]); [MyPin setSELEcted:YES]; } else if ([AnnotationPoint.title isEqualToString:@"desTination"]) { MyPin.image = [UIImage imagenamed:@"desTination_pin_up"]; MyPin.centerOffset = CGPointMake(-13,[up/down]); [MyPin setSELEcted:YES]; } return MyPin; }
以上是大佬教程为你收集整理的iOS mapView – 只需轻按一下即可拖动图钉全部内容,希望文章能够帮你解决iOS mapView – 只需轻按一下即可拖动图钉所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。