xcode 中的 Mapkit 中的重置按钮和书签按钮
我目前正在开发一个涉及mapkit 的应用程序。我想在视图上添加一个重置按钮,当您打开程序时,该按钮会将视图重置为其默认视图,或者更好的是,当您打开和关闭应用程序时,mapkit 会自行重置。
我用来设置初始区域的代码如下:
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 54.049929;
region.center.longitude = -4.54834;
region.span.longitudeDelta = 4.5;
region.span.latitudeDelta = 4.5;
[mapView setRegion:region animated:YES];
任何帮助将不胜感激。
I am currently working on an application involving mapkit. I would like to add a reset button on the view which resets the view to its default view when you open the program, or better still, the mapkit resets itself when you open and close the app.
The code i have used to set the initial region is as follows:
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 54.049929;
region.center.longitude = -4.54834;
region.span.longitudeDelta = 4.5;
region.span.latitudeDelta = 4.5;
[mapView setRegion:region animated:YES];
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
存储地图的位置
在 .h 文件中
设置初始区域时
在重置按钮中
Store the Location of your map
In .h file
When setting initial Region
In your Reset Button
那么,您是否想弄清楚如何实际将按钮添加到视图并将其链接到代码中的方法?
该方法中的代码本身与您用于初始设置的代码相同,如上面的 BuildSucceded 所示...
您应该只向工具栏/导航栏添加一个按钮(如果有的话),并将其链接到“resetMap()”方法。
So, are you trying to figure out how to actually add the button to the view and link it to a method in the code?
The code itself within the method would just be the same as you used for your initial setup, as indicated by BuildSucceded above ...
You should just add a button to the toolbar/navbar(if you have one), and link it to a "resetMap()" method.