如何传递纬度和经度值

时间:2011-04-01 09:18:29

标签: iphone

我是新的iphone开发者,在这段代码中,我发现我想要传递纬度和经度值的lat,longt值而不是(37.3317& -122.0307)但是错误即将到来,请给我打电话如何通过lat& ; longt值而不是整数值

double degrees = newLocation.coordinate.latitude;
NSString *lat = [NSString stringWithFormat:@"%f",degrees];
lable1.text = lat;
degrees = newLocation.coordinate.longitude;
NSString *longt = [NSString stringWithFormat:@"%f",degrees];
lable2.text = longt;
//NSInteger a=[lat doubleValue];

//NSInteger degreess=a;
CLLocationCoordinate2D corde;
corde.latitude=37.3317;
corde.longitude=-122.0307;
MKReverseGeocoder *geocoder=[[MKReverseGeocoder alloc] initWithCoordinate:corde];
[geocoder setDelegate:self];
[geocoder start];

1 个答案:

答案 0 :(得分:0)

CLLocationCoordinate2D接受纬度和经度的双倍值

corde.latitude = [lat doubleValue];

corde.longitude = [longt doubleValue];

它适用于你