Which dataType will return the value (37.961498) as it is ? Double didn't work

前端 未结 3 1159
无人共我
无人共我 2021-01-17 06:32

Which dataType will return the value (37.961498) as it is?

I am working in MapView. Where, at present I am setting annotation and hence I have to set CLLocationCoor

3条回答
  •  無奈伤痛
    2021-01-17 06:39

    When converting a string to a double you should be using doubleValue instead of floatValue

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

    also not critical but I wouldn't recommend naming your doubles as int1 and int2 that is likely to cause you confusion at some point

提交回复
热议问题