- C/C++ code
- (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnnotation>)annotation{ if(![annotation isKindOfClass:[MyAnnotation class]]) // Don't mess user location return nil; MKAnnotationView *annotationView = [aMapView dequeueReusableAnnotationViewWithIdentifier:@"spot"]; if(!annotationView) { annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"spot"]; annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [(UIButton *)annotationView.rightCalloutAccessoryView addTarget:self action:@selector(openSpot:) forControlEvents:UIControlEventTouchUpInside]; annotationView.enabled = YES; annotationView.canShowCallout = YES; annotationView.centerOffset = CGPointMake(7,-15); annotationView.calloutOffset = CGPointMake(-8,0); } // Setup annotation view annotationView.image = [UIImage imageNamed:@"pinYellow.png"]; // Or whatever return annotationView;}
------解决方案--------------------
http://www.cocoachina.com/bbs/read.php?tid-30567-keyword-%B7%C5%B4%F3%BE%B5.html
取坐标区域,放大这个区域,放在一个View上显示在最上层。OK了
------解决方案--------------------
楼主想说地图上有一个蓝点,有淡蓝色光圈的那个效果吗?如果是那个的话,可以在ib中将你的mkmapview控件中的shows user location勾选,或者在你定义的mkmapview对象中:你的地图对象.showsUserLocation = YES;
------解决方案--------------------
楼上正解 地图对象.showsUserLocation = YES;
------解决方案--------------------
虚拟机好像默认是显示在欧洲还是美国的某个地方,不过真机可以显示你当前的位置