0
무엇이 잘못 되었습니까? 나는 총 거리를 얻으려고 노력하고 있지만, 내가 운전을 시작할 때 나는 내 가치가 떨어지기 시작 했단 말인가? 무엇을 고칠 필요가 있습니다. 고맙습니다.정확한 거리 측정
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if (startLocation == nil)
{
self.totalDistanceBetween = 0; // declare this variable
self.startLocation = newLocation;
}
CLLocationDistance distanceBetween = [newLocation distanceFromLocation:startLocation ];
startLocation = newLocation;
self.totalDistanceBetween += distanceBetween; // declare this variable
NSString *tripString = [[NSString alloc] //convert to string
initWithFormat:@"%f",
self.totalDistanceBetween];
distance.text = tripString; //update my distance label called distance
}
변수 유형이 될 totaldistancebetween한다 :
– 4GetFullOf@Rookie CLLocationDistance 또는 double –
@Rookie이 클래스의 멤버 또는 정적 변수로 선언해야하지만 함수 내에 포함되지 않아야합니다. –