我是iphone應用程序開發新手,我需要代碼當前位置的用戶。我想使用地圖工具包在我的應用程序中顯示他的位置。請告訴我該怎麼做?如何知道iPhone中的當前位置?
0
A
回答
0
你可以參考蘋果的文檔,這CLLocationmanager class reference
0
- (IBAction) showCurrentLocation{
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.007;
span.longitudeDelta=0.007;
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];
//NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
region.span=span;
region.center=location;
[mapview setRegion:region animated:TRUE];
[mapview regionThatFits:region];
}
0
你需要告訴地圖視圖來顯示用戶的位置(這不是在默認情況下)。這增加了viewDidLoad中:
[mapView setShowsUserLocation:YES];
注意,在模擬器中,用戶位置總是加州庫柏蒂諾市,所以它取決於地圖的當前中心和縮放,你可能看不到。
相關問題
- 1. 如何將iphone中的當前位置
- 2. 如何知道UIImageView移動的當前位置?
- 3. 如何知道當前鼠標位置有哪些元素?
- 4. 如何知道當前PC
- 5. 如何知道彙編代碼中的當前進位標誌?
- 6. iphone mapview當前位置
- 7. 如何知道iPhone中iPhone
- 8. UIScroll查看iphone中的當前位置
- 9. 如何知道Andengine在manageupdate中的身體以前的位置?
- 10. 如何從iPhone中確定當前位置iphone
- 11. 如何知道Visual Studio 2010中當前行在運行時的位置?
- 12. 如何知道當前可見視圖的標籤iphone
- 13. 如何知道在自定義路徑上旋轉的圓的當前位置?
- 14. 如何知道UIView在屏幕左側或右側的當前位置?
- 15. 當前位置的iPhone mapKit註釋
- 16. 使用當前位置的大陸iPhone
- 17. 從PHP不知道當前配置
- 18. 如何知道MouseMove之前的鼠標位置
- 19. 遍歷二維數組,並知道當前位置
- 20. Calendar.getInstance()如何知道當前年份?
- 21. 如何知道javascript的輸入位置
- 22. 如何知道ItemTemplate的序號位置
- 23. 我如何知道「Program Files」的位置?
- 24. 如何知道mysql my.cnf的位置
- 25. 如何知道一個點的位置?
- 26. iPhone applicationWillResignActive - 如何通知當前UIView
- 27. 如何在iPhone SDK中找到當前位置
- 28. 如何在iPhone中查找當前位置?
- 29. 如何知道位置是地圖中另一個位置的前/後的位置
- 30. 卡住當前位置 - iphone sdk
你有沒有確切的例子?請給我鏈接 – Chinna 2011-05-26 10:21:59