[ios] Fixed compass angle when device changes orientation to landscape

@TODO fix ShapeRenderer::approximateArc() to draw sector using north ("up" in screen coordinates)
This commit is contained in:
Alex Zolotarev 2011-10-23 18:04:41 +03:00 committed by Alex Zolotarev
parent 0aa7a5ea25
commit 2b95d407d0
4 changed files with 14 additions and 0 deletions

View file

@ -312,6 +312,7 @@ NSInteger compareAddress(id l, id r, void * context)
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
{
[[MapsAppDelegate theApp].m_locationManager setOrientation:self.interfaceOrientation];
[self Invalidate];
}

View file

@ -212,6 +212,11 @@ static void OnSearchResultCallback(search::Result const & res, int queryId)
[super viewWillDisappear:animated];
}
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
{
[m_locationManager setOrientation:self.interfaceOrientation];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES; // All orientations are supported.

View file

@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIApplication.h>
#include "../../platform/location.hpp"
@ -21,4 +22,6 @@
- (void)start:(id <LocationObserver>)observer;
- (void)stop:(id <LocationObserver>)observer;
- (CLLocation *)lastLocation;
// Fixes compass angle orientation when rotating screen to landscape
- (void)setOrientation:(UIInterfaceOrientation)orientation;
@end

View file

@ -137,4 +137,9 @@
return YES;
}
- (void)setOrientation:(UIInterfaceOrientation)orientation
{
m_locationManager.headingOrientation = (CLDeviceOrientation)orientation;
}
@end