开发者

expected expression before '{' token

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜