2011-07-15 26 views
0

我想創建一個需要userLocation的應用程序,但MkMapView.userLocation只是只讀的,不能更改。我怎麼用它?我可以設置userLocation,如 myMap.userLocation = MyCurrentLocation;如何在iPhone上移動MkMapView.userLocation?

我需要的任何代碼才能讓它變得簡單嗎?

回答

2

您需要CLLocationManager以獲取用戶的當前位置更新。 locationManager:didUpdateToLocation:fromLocation:方法CLLocationManagerDelegate將更新您當前的用戶位置。

您可以按照this tutorial學習實施它。

+0

換句話說,你不能僞造你的位置。 –