iphone - how to convert the nsstring value of text into CLLocationCoordinate2D in objective-c for google map -


I want to give the user the option to provide a location name, which he wants to search for from the iPhone in Google Maps. When the user gave the name of the place which should be the special map.

Now I am doing this by fixing the value of coordinating its object latitude and longitude.

  CLLocationCoordinate2D location = mapView.userLocation.coordinate; Location.latitude = 19.14; Location.longitude = 73.10;  

Is the value of this coordinate in text and it is converted into the value of CLLocationCoordinate2D?

I am not completely clear on your question, but if you NSString To change the CLLocationCoordinate2D you can use the following:

  {[self useLocationString: @ "19.14,73.10"]; } - (zero) useLocationString: (NSString *) loc {// place object that we want to start based on the string CLLocationCoordinate2D location; // Split the string by commas NSArray * locationArray = [loc componentsSeparatedByString: @ ","]; // Set our latitude and longitude on the basis of two divisions in the string space. Latitude = [[[NSNL Alok] initWithDouble: [[locationArray objectAtIndex: 0] double value]] autorelease]; Location.longitude = [[[NSNumber alloc] initWithDouble: [[LocationArray ObjectOutIndex: 1] Double Value]]]]]; // do something with the location}  

This code does not check the validity of the string, which you can check NSArray from the components Separate Best Stuff


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -