[iOS] Compass heading fix

This commit is contained in:
Kirill Zhdanovich 2013-07-10 18:01:23 +03:00 committed by Alex Zolotarev
parent d79fa94ea8
commit 909a62b696
7 changed files with 9 additions and 22 deletions

View file

@ -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)

View file

@ -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];
}

View file

@ -57,6 +57,7 @@ void InitLocalizedStrings()
- (void) applicationWillEnterForeground: (UIApplication *) application
{
[m_locationManager orientationChanged];
[m_mapViewController OnEnterForeground];
}

View file

@ -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])

View file

@ -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.

View file

@ -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;

View file

@ -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