开发者

objective-c : How to find heading (direction) from location services?

开发者 https://www.devze.com 2023-03-25 19:10 出处:网络
Iam working on Location serves and want o get heading from location services, I have all desired attributes e.g. latitude, longitude etc but I want to find Direction (heading) too

Iam working on Location serves and want o get heading from location services, I have all desired attributes e.g. latitude, longitude etc but I want to find Direction (heading) too

 (void)locationUpdate:(CLLocation *)location {
    locationLable.text = [location description];
    CLLocationCoordinate2D coordinate = [location coordinate];
    NSLog(@"This is location   %@",[location description]);
    NSLog(@"Lattitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.latitude]);
    NSLog(@"Langitude          =   %@",[NSString stringWithFormat:@"%f", coordinate.longitude]);
    NSLog(@"Altitude           =   %@",[NSString stringWithFormat:@"%gm", location.altitude]);
    NSLog(@"horizontalAccuracy =   %@",[NSString stringWithFormat:@"%gm", location.horizontalAccuracy]);
    NSLog(@"verticalAccuracy   =   %@",[NSString stringWithFormat:@"%gm", location.verticalAccuracy]);
    NSLog(@"Speed   =   %@",[NSS开发者_Python百科tring stringWithFormat:@"%gm", location.speed]);

}


- (void)headingUpdate:(CLHeading *)heading {
    NSLog(@"This is heading   %@",[heading description]);

}

- (void)viewDidLoad {
    locationController = [[MyCLController alloc] init];
    locationController.delegate = self;
    [locationController.locationManager startUpdatingLocation];
    [locationController.locationManager startUpdatingHeading];
}

I found some clue to get it from CLHeading but still unable to get it from CLHeading. I am using the above code


Read http://developer.apple.com/library/ios/#DOCUMENTATION/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html :) I think you should use trueHeading, I guess..

trueHeading

The heading (measured in degrees) relative to true north. (read-only) @property(readonly, nonatomic) CLLocationDirection trueHeading

0

精彩评论

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