Wednesday, January 15, 2014

iphone can get the latitude and longitude of your current location in the program under

If that is the ability to use the code to get latitude and longitude of the current position of the machine?
Reply:
Must be able to
Reply:
Yes, the need to use CLLocationManagerDelegate and CLLocationManager these classes, you can go to check the documents, there are many examples
CLLocationManagerDelegate inside your class implements this method can be:
- LocationManager: didUpdateToLocation: fromLocation:
Reply:
CLLocationManager * location;

location = [[CLLocationManager alloc] init];
[Location setDelegate: self];
[Location setDesiredAccuracy: kCLLocationAccuracyBest];
[Location setDistanceFilter: 10];
[Location startUpdatingLocation] ;/ / here will have to call the following method

- (Void) locationManager: (CLLocationManager *) manager didUpdateToLocation: (CLLocation *) newLocation fromLocation: (CLLocation *) oldLocation {

latitude = newLocation.coordinate.latitude;
longitude = newLocation.coordinate.longitude;
/ / This method was newLocation, is that you have the current location, you can get through it to get the current latitude and longitude.

But you also have to have the machine hardware support

No comments:

Post a Comment