2011-09-01 73 views

回答

12

double是iOS本身使用的值。 iOS使用CLLocationDegrees來表示緯度/長度值,它是typedef

IMO,使用double/CLLocationDegrees將是最好的選擇。

+1

爲什麼不使用'CLLocationDegrees'? – deanWombourne

+0

'CLLocationDegrees'只是double的一個typedef。但是看到Dean的最新評論,使用CLLocationDegrees – rckoenes

+0

@deanWombourne,;-)當然會更糟糕。我已經提到CLLocationDegrees是double的typedef。 – EmptyStack

2

不,它不會,因爲緯度/長度iOS將使用也是一個雙。

/* 
* CLLocationDegrees 
* 
* Discussion: 
* Type used to represent a latitude or longitude coordinate in degrees under the WGS 84 reference 
* frame. The degree can be positive (North and East) or negative (South and West). 
*/ 
typedef double CLLocationDegrees; 
3

有已經是一個問題的答案在iOS SDK中:)

乘坐look at CLLocationCoordinate2D - 它使用CoreLocation來存儲它的使用CLLocationDegrees型LAT/LNGS。如果這就是CoreLocation給你的準確度,那麼這是一個準確的,因爲它會得到!

5

綜觀CLLocationCoordinate2D的定義:

typedef struct { 
    CLLocationDegrees latitude; 
    CLLocationDegrees longitude; 
} 
CLLocationCoordinate2D; 

然後CLLocationDegrees的位置;

typedef double CLLocationDegrees; 

我們可以看到精度是雙倍的。因此,你不能做得更好。

相關問題