views:

4977

answers:

3

Hi all,

I have an array with NSString's in it. Some of these are latitude and longitudes and I need to use this with the below code.

The latText and lonText are my strings that I am trying to use as co-ordinates....

   CLLocationCoordinate2D pinlocation=mapView.userLocation.coordinate;

 pinlocation.latitude = latText;

 pinlocation.longitude  =lonText;
+7  A: 
pinlocation.latitude = [latText doubleValue];
Jane Sales
Thanks Jane, so simple but works a treat!
Lee Armstrong
A: 

This doesn´t worked.

currentLatitude is an String (52.50277)

After the next Line coord1.latitude is -4.2179938241709037e

coords1.latitude =[currentLatitude doubleValue];

So any one another working solution?

It worked for me! :-)
Lee Armstrong
A: 

What is the reverse solution, that is how to convert latitude/longitude to string?

Neeraj
perhaps: NSString *latText = [NSString stringWithFormat:@"%f",pinLocation.latitude]
Neeraj
Since it's not an *answer* to the question at the top, this would be better posted as a separate question...
sth