哪个数据types将返回值(37.961498),因为它? 双没有工作

哪个数据types将返回值(37.961498),因为它?

我正在MapView中工作。 其中,目前我正在设置注释,因此我必须设置CLLocationCoordinate2DMake从googleAPI(例如:lat =“37.9615000”和lng =“60.5566000”)parsing一些lat和lng。 我有string中的值,因此我转换为双重刺激,然后分配但没有帮助。 请有人帮助我。

double int1=[num1s floatValue]; double int2=[num2s floatValue]; NSLog(@" %f %f ",int1,int2); annotation.coordinate=CLLocationCoordinate2DMake(int1, int2); 

实际值是:37.9615000,60.5566000 NSLog中获得的值:37.961498,60.556599

提前致谢。

更多的解释和理由为什么我需要确切的价值:

我需要为中国设置注释使用lat和lan(lat =“53.5609740”; lng =“134.7728099”)

但是,当从string再次转换值的变化

在这里输入图像说明

string转换为double ,应该使用doubleValue而不是floatValue

 double int1=[num1s doubleValue]; double int2=[num2s doubleValue]; NSLog(@" %f %f ",int1,int2); annotation.coordinate=CLLocationCoordinate2DMake(int1, int2); 

也没有批评,但我不会推荐你的双打命名为int1和int2,这可能会导致你在某个时候的困惑

 annotation.coordinate=CLLocationCoordinate2DMake([nums doubleValue], [int2 doubleValue]); 

尝试这个

 double int1=[num1s floatValue]; double int2=[num2s floatValue]; NSLog(@" %0.7f %0.7f ",int1,int2); annotation.coordinate=CLLocationCoordinate2DMake(int1, int2); 

阅读string格式说明符的更多信息。