forked from organicmaps/organicmaps
[iOS] Compass heading fix
This commit is contained in:
parent
d79fa94ea8
commit
909a62b696
7 changed files with 9 additions and 22 deletions
|
@ -402,11 +402,6 @@
|
|||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
|
||||
{
|
||||
[m_locationManager setOrientation:self.interfaceOrientation];
|
||||
}
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField
|
||||
{
|
||||
if (textField.text.length == 0)
|
||||
|
|
|
@ -529,7 +529,6 @@ NSInteger compareAddress(id l, id r, void * context)
|
|||
|
||||
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
|
||||
{
|
||||
[[MapsAppDelegate theApp].m_locationManager setOrientation:self.interfaceOrientation];
|
||||
[self showPopover];
|
||||
[self Invalidate];
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ void InitLocalizedStrings()
|
|||
|
||||
- (void) applicationWillEnterForeground: (UIApplication *) application
|
||||
{
|
||||
[m_locationManager orientationChanged];
|
||||
[m_mapViewController OnEnterForeground];
|
||||
}
|
||||
|
||||
|
|
|
@ -256,11 +256,6 @@
|
|||
return [text sizeWithFont:font constrainedToSize:CGSizeMake([self getCurrentSuperViewWidth] - 2 * MARGIN, CGFLOAT_MAX) lineBreakMode:NSLineBreakByCharWrapping].height + 2 * SMALLMARGIN;
|
||||
}
|
||||
|
||||
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
|
||||
{
|
||||
[m_locationManager setOrientation:(CLDeviceOrientation)fromInterfaceOrientation];
|
||||
}
|
||||
|
||||
-(CGFloat) countHeight
|
||||
{
|
||||
if ([self.secondaryInfo length])
|
||||
|
|
|
@ -312,11 +312,6 @@ static void OnSearchResultCallback(search::Results const & res)
|
|||
numberOfRowsInEmptySearch = 0;
|
||||
}
|
||||
|
||||
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
|
||||
{
|
||||
[m_locationManager setOrientation:self.interfaceOrientation];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
return YES; // All orientations are supported.
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
- (CLLocation *)lastLocation;
|
||||
- (CLHeading *)lastHeading;
|
||||
// Fixes compass angle orientation when rotating screen to landscape
|
||||
- (void)setOrientation:(UIInterfaceOrientation)orientation;
|
||||
- (void)orientationChanged;
|
||||
|
||||
- (bool)getLat:(double &)lat Lon:(double &)lon;
|
||||
- (bool)getNorthRad:(double &)rad;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
m_lastLocationTime = nil;
|
||||
m_isCourse = NO;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged) name:UIDeviceOrientationDidChangeNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -33,6 +34,7 @@
|
|||
[m_observers release];
|
||||
[m_locationManager release];
|
||||
[m_lastLocationTime release];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -202,11 +204,6 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)setOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
m_locationManager.headingOrientation = (CLDeviceOrientation)orientation;
|
||||
}
|
||||
|
||||
- (bool)getLat:(double &)lat Lon:(double &)lon
|
||||
{
|
||||
CLLocation * l = [self lastLocation];
|
||||
|
@ -251,4 +248,9 @@
|
|||
return (([self lastLocation] != nil) && ([m_lastLocationTime timeIntervalSinceNow] > -300.0));
|
||||
}
|
||||
|
||||
-(void)orientationChanged
|
||||
{
|
||||
m_locationManager.headingOrientation = (CLDeviceOrientation)[UIDevice currentDevice].orientation;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue