开发者

expected expression before '{' token

开发者 https://www.devze.com 2023-03-02 04:04 出处:网络
please i didn\'t understand what wrong whith my code : float lng = [[stationEnCours objectForKey:@\"ssiphone_longitude\"] floatValue];

please i didn't understand what wrong whith my code :

float lng = [[stationEnCours objectForKey:@"ssiphone_longitude"] floatValue];
float lat = [[stationEnCours objectForKey:@"ssiphone_latitude"] floatValue];

location2D={latitude:lat,longitude:lng};//this line which cause error
MKCoordinateSpan span={latitudeDelta:0.2,longitudeDelta:0.2};
MKCoordinateRegion region={location2D,span};
[m开发者_Go百科apView setRegion:region];
[self.view addSubview:mapView];

lng an lat have really the longitude and latitude value, i maked sure on the console :) thx for help :)


Try:

location2D = (CLLocationCoordinate2D){ .latitude = lat, .longitude = lng };

or simply:

location2D = (CLLocationCoordinate2D){ lat, lng };


is better to use built-in macros & functions: so:

CLLocationCoordinate2D newCoord = CLLocationCoordinate2DMake(lng, lat);

don't worry about speed... these functions are very efficient.

0

精彩评论

暂无评论...
验证码 换一张
取 消