监视工具地图:显示当前位置 [英] Watchkit Maps: show current location
问题描述
我制作了一个应用程序,可以在扩展应用程序中计算当前位置,我想在观察中展示它.这该怎么做?只有一种方法可以显示不同颜色的图钉.
I have made application where we can calculate current location in extention app and I would like to show it at watch. How to do this? There is a methods only to show pin with different color.
推荐答案
如果具有该位置的坐标,则可以在WKInterfaceMap上使用- (void)addAnnotation (CLLocationCoordinate2D)location withImage:(UIImage *)image centerOffset:(CGPoint)offset
.传递第一个参数的位置,并传递要显示当前位置的引脚的UIImage.您还需要确定并致电setVisibleMapRect
,以便地图显示位置.
If you have the coordinates for the location you can use - (void)addAnnotation (CLLocationCoordinate2D)location withImage:(UIImage *)image centerOffset:(CGPoint)offset
on WKInterfaceMap. Pass in the location for the first parameter and pass in a UIImage for the pin that you want to show for the current location. You will also want to be sure and call setVisibleMapRect
so that the map shows the location.
这篇关于监视工具地图:显示当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!