我在我的 iOS 应用程序中使用 MKMapView。我的 View 中有搜索栏。如果我在 map 上搜索位置,我会在该搜索到的位置上添加注释。现在的问题是,我想回到我现在的位置。我看过谷歌地图应用程序,他们在 map 上有一个按钮,可以将用户发送到当前位置。
如何显示该按钮?。以及如何获取该按钮的点击事件?。
最佳答案
- (void)viewDidLoad
{
[super viewDidLoad];
MKUserTrackingBarButtonItem *buttonItem = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.map];
self.navigationItem.rightBarButtonItem = buttonItem;
}
关于ios - ios MKMapView 上的当前位置按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26928982/