簡體   English   中英

iOS 6和Mapkit:用戶位置

[英]iOS 6 and Mapkit : User location

當我看到我的應用程序無法通過iOS6上的MapKit知道我的位置時,我感到很驚訝!

我只是想在地圖開始時縮放到用戶的位置! 我該怎么做 ?

請幫我

非常感謝 !! (PS:我看到用於發送路由請求的CLCoordinate工作正常)

你的意思是showsUserLocation沒有任何影響嗎? 或者您的位置監控沒有更新您的位置? 我在iOS 6中測試過,對我有用。 也許你可以發布一些代碼。

編輯:

似乎位置監控未在您的應用中激活。 首先,你必須這樣做才能啟用cllocation manager:

if (nil == locationManager)
    locationManager = [[CLLocationManager alloc] init];

//set the delegate for the location manager
locationManager.delegate = self;
// set your desired accuracy
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;

[locationManager startUpdatingLocation];

此時,藍色位置指示器應該是可見的。 只要您在地圖上設置showsUserLocation = YES即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM