我也很愚蠢,我想将NSString
或NSNumber
放入initWithLatitude
的CLLocation
中。如果有人可以帮助,那就太好了。
继承人的代码
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:53.683267 longitude:-0.011330];
label.text = [NSString stringWithFormat:@"Distance in miles: %4.1f", [location1 distanceFromLocation:location2]/1609.344];
[location1 release];
我正在尝试用
[[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887]
替换[[CLLocation alloc] initWithLatitude:lat longitude:lon]
最佳答案
CLLocationDegrees
是double
,因此您可以
[[CLLocation alloc] initWithLatitude:[someNSNumber doubleValue] longitude:[someNSString doubleValue]];
关于iphone - 将nsnumber或nsstring放入initWithLatitude中:,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11837051/