6月
25
2009

MapKitの地図を回転させる

あちこちで公開されてるiPhone 3GSの写真を見てると,デジタルコンパスを使ってMap.appが回転してる!!
MapKitの公式ドキュメントにはそれらしきコトは一切書いてないので非公開APIの模様

ということで,class-dumpでちょっと調べてみた
MapKitをダンプして「heading」というキーワードで探すと,なにやら関係ありそうな名前のメソッド発見

@interface MKMapView (MKHeadingAdditions)
- (BOOL)canRotateForHeading;
- (struct CGRect)contentBounds;
- (BOOL)isHeadingEnabled;
- (void)_updateHeadingEnabled;
- (void)setHeadingEnabled:(BOOL)fp8;
- (BOOL)isHeadingSupported;
- (void)setHeadingSupported:(BOOL)fp8;
- (BOOL)shouldRotateForHeading;
- (void)setShouldRotateForHeading:(BOOL)fp8;
- (void)pauseUserHeadingUpdates;
- (void)resumeUserHeadingUpdates;
- (void)_setContentAnchorPoint:(struct CGPoint)fp8;
- (void)_resetMapAnchorPoint:(BOOL)fp8;
- (struct CGPoint)_anchorWithContentPoint:(struct CGPoint)fp8;
- (struct CGPoint)userLocationAnchorPoint;
- (struct CGPoint)visualAnchorPoint;
- (void)_updateMapAnchorPoint:(struct CGPoint)fp8;
- (void)_updateMapAnchorCoordinate:(CDAnonymousStruct2)fp8;
- (void)_updateMapAnchorPoint;
- (BOOL)isHeadingTrackingEnabled;
- (void)setHeadingTrackingEnabled:(BOOL)fp8;
- (void)disableHeadingTracking:(BOOL)fp8;
- (void)disableMapRotation:(BOOL)fp8;
- (void)enableMapRotationIfNeeded;
- (void)_startTrackingHeading;
- (void)_stopTrackingHeading;
- (BOOL)_updateRotationSupported;
- (void)_finalizeChange:(id)fp8 rotation:(float)fp12 layer:(id)fp16 type:(int)fp20;
- (void)_applyHeadingChange:(id)fp8 layer:(id)fp12 annotationViews:(id)fp16 cc:(BOOL)fp20 delegate:(BOOL)fp24 rotationType:(int)fp28;
- (void)_stopRotationLayer:(id)fp8 annotationViews:(id)fp12;
- (void)_updateRotationType:(int)fp8 change:(id)fp12;
- (void)_resetOverlayViewPerspective;
- (void)_updateOverlayViewPerspective:(BOOL)fp8;
- (void)_updateHeading:(id)fp8 rotationType:(int)fp12 animated:(BOOL)fp16;
- (void)locationManagerUpdatedHeading:(id)fp8;
- (void)locationManagerFailedToUpdateHeading:(id)fp8 withError:(id)fp12;
@end

他には,公式サイトにも掲載されているけど.CoreLocationにCLHeadingというクラスが追加されてる

この辺いじってやれば地図を回転させられそうだが,その前にコンパスがついてない
っていうかGPSすらついてないorz

Written by h2 in: ガジェット | タグ:

コメントはまだありません »

RSS feed for comments on this post. TrackBack URL

コメントをどうぞ

TheBuckmaker WordPress Themes Webhosting, MP3, AAC & Co