distanceFromLocation - Calculate distance between two points

后端 未结 7 1087
礼貌的吻别
礼貌的吻别 2020-11-29 21:27

Just a quick question on Core Location, I\'m trying to calculate the distance between two points, code is below:

    -(void)locationChange:(CLLocation *)newL         


        
7条回答
  •  醉话见心
    2020-11-29 21:27

    #import 
    
    CLLocation *locA = [[CLLocation alloc] initWithLatitude:"Value" longitude:"Value"];
    
    CLLocation *locB = [[CLLocation alloc] initWithLatitude:"Value" longitude:"Value"];
    
    CLLocationDistance distance = [locA distanceFromLocation:locB];
    NSLog(@"distance:-%f",distance);//distance in Miter
    

提交回复
热议问题