문제

cllocationManager Object의 DidupDateHeading 이벤트를 사용하여 결과 Heading.x 및 Heading.y 값을 어떻게 계보의 이미지에 플로팅 할 수 있습니까?

도움이 되었습니까?

해결책

제목 학위의 경우 사용할 수 있습니다 magneticHeading 그리고 trueHeading 대신 속성 x 그리고 y.

진정한 헤드

True North와 관련하여 제목 (정도로 측정). (읽기 전용)

@property(readonly, nonatomic) CLLocationDirection trueHeading

논의

이 속성의 값은 지리적 북극을 향한 제목을 나타냅니다. 이 속성의 값은 장치의 물리적 또는 인터페이스 방향에 관계없이 항상 장치 상단에 대해보고됩니다. 값 0은 True North를 나타내고, 90은 동쪽으로, 180은 남쪽으로 표시되는 등을 나타냅니다. 음수 값은 제목을 결정할 수 없음을 나타냅니다.

다른 팁

이것이 내가 나침반의 이미지로 UIImageview를 회전시키는 방법입니다. 북쪽 바늘은 원래 이미지를 위쪽으로 향하고있었습니다.

if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
            NSLog(@"UIInterfaceOrientationLandscapeLeft");
            [self.compassImageViewIphone setTransform:CGAffineTransformMakeRotation((((newHeading.magneticHeading - 90) *3.14/180)*-1) )];

        }else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight){
            NSLog(@"UIInterfaceOrientationLandscapeRight");
            [self.compassImageViewIphone setTransform:CGAffineTransformMakeRotation((((newHeading.magneticHeading + 90) *3.14/180)*-1))];

        }else if (self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
            NSLog(@"UIInterfaceOrientationPortraitUpsideDown");
            [self.compassImageViewIphone setTransform:CGAffineTransformMakeRotation((((newHeading.magneticHeading + 180) *3.14/180)*-1) )];

        }else{
            NSLog(@"Portrait");
            [self.compassImageViewIphone setTransform:CGAffineTransformMakeRotation((newHeading.magneticHeading *3.14/180)*-1)];
        }

노력하다:

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {

   CLLocationDirection trueNorth = [newHeading trueHeading];

   CLLocationDirection magneticNorth = [newHeading magneticHeading];

}

CllocationDirection은 Typedef Double이므로 True 또는 Magnetic Heading을 각도로 얻습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top