diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index e7560e2fd5..2ccd1a0cd9 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -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]; } diff --git a/iphone/Maps/Classes/SearchVC.mm b/iphone/Maps/Classes/SearchVC.mm index 87e2e63ca9..5b2b155d8d 100644 --- a/iphone/Maps/Classes/SearchVC.mm +++ b/iphone/Maps/Classes/SearchVC.mm @@ -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. diff --git a/iphone/Maps/Platform/LocationManager.h b/iphone/Maps/Platform/LocationManager.h index 57adcd35d4..a88f496126 100644 --- a/iphone/Maps/Platform/LocationManager.h +++ b/iphone/Maps/Platform/LocationManager.h @@ -1,5 +1,6 @@ #import #import +#import #include "../../platform/location.hpp" @@ -21,4 +22,6 @@ - (void)start:(id )observer; - (void)stop:(id )observer; - (CLLocation *)lastLocation; +// Fixes compass angle orientation when rotating screen to landscape +- (void)setOrientation:(UIInterfaceOrientation)orientation; @end diff --git a/iphone/Maps/Platform/LocationManager.mm b/iphone/Maps/Platform/LocationManager.mm index 3acdd9a365..a3d2f0bd0f 100644 --- a/iphone/Maps/Platform/LocationManager.mm +++ b/iphone/Maps/Platform/LocationManager.mm @@ -137,4 +137,9 @@ return YES; } +- (void)setOrientation:(UIInterfaceOrientation)orientation +{ + m_locationManager.headingOrientation = (CLDeviceOrientation)orientation; +} + @end