[英]How will get current location in iphone
我正在 iphone 中集成谷歌 map。 我必須在 map 中顯示當前位置。 我將如何獲得當前位置?
謝謝
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
在以下文章中搜索Accessing the Device's Current Location
:
MapView.showsUserLocation = YES;
)相關的SO帖子:
我想問題已經回答了——
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
把它放在viewdidappear:animated
那么你應該發現你有正確的位置。 盡快這樣做,位置還沒有確定,你可能最終會在海里:)
簡短的回答是編寫類似mapview.showsUserLocation = YES;
的代碼。 ,其中 mapview 是您的 UIMapView class object。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.