简体   繁体   English

iPhone开发人员-无法在mapView上显示用户的当前位置

[英]iPhone dev - Can't show user's current location on mapView

I set the mapView's showUserLocation property to YES, and it does nothing. 我将mapView的showUserLocation属性设置为YES,但它什么也不做。 I was able to use a CLLocationManager to center the map on the user's current location, but there's no pin/dot on the screen. 我可以使用CLLocationManager将地图置于用户当前位置的中心,但是屏幕上没有图钉/点。 How can I put a pin on the map for the exact location of the user? 如何在地图上放置大头针以查看用户的确切位置?

在Nib名称中,您可以设置showuserlocation来标记Mapview。

This has messed me up several times but its an easy fix 这使我烦了好几次,但是很容易解决

The problem is that your code is: 问题是您的代码是:

 [self.mapView showUserLocation:YES];

Should be: 应该:

 [self.mapView setShowsUserLocation:YES]

Also make sure you have set the delegate as well 还要确保您也设置了委托

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM