|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Apr 2010
Posts: 8
|
Hi everybody,
I am using a MapView to display the position of a property. These coordinates will eventually be pulled from a database, so I'm not using CoreLocation to return a coordinate in this part of the app. Here is my code: Code:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. CLLocationCoordinate2D coord;
coord.longitude = (CLLocationDegrees)[rp.locLat doubleValue];
coord.latitude = (CLLocationDegrees)[rp.locLng doubleValue];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Title" message:[[NSString alloc]initWithFormat:@"%f, %f", [rp.locLat doubleValue], [rp.locLng doubleValue]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
MKCoordinateRegion region;
region.center = coord;
MKCoordinateSpan span = {1, 1};
region.span = span;
mapView.region = region;
However, the MapView centres the map just off the coast of the Seychelles which is obviously not correct. Initially I thought maybe it doesn't want a decimal representation of the lat/lng so I got the CoreLocation functionality to spit out a lat/lng for the devices current position. The UIAlertView above displays the text: "53.478239, -2.246704", so I know that the values stored in the rp object are correct. This gives me 37.332..., -122.031... (Apples HQ, which is correct). You can enter these values into maps.google.com and it gives you the correct position so I can assume my values are in the correct format. The only thing I can think of is these lines: Code:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. coord.longitude = (CLLocationDegrees)[rp.locLat doubleValue]; coord.latitude = (CLLocationDegrees)[rp.locLng doubleValue]; I'm stumped, so if anyone has any ideas at all that would be great. Cheers, Dave |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |




Linear Mode
