【发布时间】:2012-10-13 14:08:09
【问题描述】:
所以我将我的应用设置为在按下按钮时搜索用户的位置。
-(IBAction)getLocation {
mapview.showsUserLocation = YES;}
然后我在使用此加载地图视图时也将地图注释设置到某个位置
- (void)viewDidLoad{
[super viewDidLoad];
// Do any additional setup after loading the view.
[mapview setMapType:MKMapTypeStandard];
[mapview setZoomEnabled:YES];
[mapview setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, {0.0, 0.0 } };
region.center.latitude = 123;
region.center.longitude = 123;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapview setRegion:region animated:YES];
NewClass *ann = [[NewClass alloc] init];
ann.title = @"Place to go to";
ann.subtitle = @"subtitle";
ann.coordinate = region.center;
[mapview addAnnotation:ann];
}
是否可以使用 MapKit 在我的注释中添加“前往此处的路线”按钮?任何帮助都是极好的!谢谢!
【问题讨论】:
-
要在标注上放置一个按钮,请在 MKAnnotationView 中搜索 rightCalloutAccessoryView 属性。对于实际路线,建议从您的应用程序中打开地图应用程序,而不是尝试在应用程序中显示(iOS6 之前的 openURL,iOS6 中的 MKMapItem)。有几个步骤来实现这一切。经过更多研究,请缩小您需要帮助的部分。
标签: iphone ios xcode mkmapview