質問

のCLLocationManagerオブジェクトのdidUpdateHeadingイベント、どうやって変換結果の見出しを表示します。xおよび向上に力を注いできた。y値を度でプロットをイメージコンパス?

役に立ちましたか?

解決

のための項目度を利用でき magneticHeadingtrueHeading 性の代わりに xy.

trueHeading

の測度)対比trueます。(read-only)

@property(readonly, nonatomic) CLLocationDirection trueHeading

議論

価値をプロパティを、プロパティを表すのがポイントに向けて地域の北。価値をプロパティを、プロパティは報告の対比の上にデバイスにかかわらず、デバイスの物理的またはインターフェースに向かう。値0はtrue北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で、二重ですので、あなたは度で真または磁気見出しを取得します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top