[ios] Closes - correct orientation change

This commit is contained in:
Alex Zolotarev 2011-09-10 19:41:21 +03:00 committed by Alex Zolotarev
parent e92c4def4f
commit 51d3de573f
3 changed files with 28 additions and 26 deletions

View file

@ -304,13 +304,6 @@ NSInteger compareAddress(id l, id r, void * context)
case UIInterfaceOrientationLandscapeRight: newOrientation = EOrientation270; break;
}
m_framework->SetOrientation(newOrientation);
// needed to correctly startup in landscape
static bool firstCall = true;
if (firstCall)
{
[self.view layoutSubviews];
firstCall = false;
}
}
- (void) OnTerminate
@ -321,38 +314,33 @@ NSInteger compareAddress(id l, id r, void * context)
- (void) Invalidate
{
if (m_framework)
{
if (!m_framework->SetUpdatesEnabled(true))
m_framework->Invalidate();
}
if (!m_framework->SetUpdatesEnabled(true))
m_framework->Invalidate();
}
- (void) OnEnterBackground
{
if (m_framework)
{ // save world rect for next launch
m_framework->SaveState();
m_framework->SetUpdatesEnabled(false);
m_framework->EnterBackground();
}
// save world rect for next launch
m_framework->SaveState();
m_framework->SetUpdatesEnabled(false);
m_framework->EnterBackground();
}
- (void) OnEnterForeground
{
if (m_framework)
{
m_framework->EnterForeground();
if (m_mapIsVisible)
[self Invalidate];
}
m_framework->EnterForeground();
if (m_mapIsVisible)
[self Invalidate];
}
- (void)viewWillAppear:(BOOL)animated
{
// needed to correctly handle startup landscape orientation
// and orientation changes when mapVC is not visible
[self.view layoutSubviews];
m_mapIsVisible = true;
if (m_framework)
[self Invalidate];
[self Invalidate];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}

View file

@ -184,6 +184,13 @@ static void OnSearchResultCallback(search::Result const & res, int queryId)
return YES; // All orientations are supported.
}
// correctly pass rotation event up to the root mapViewController
// to fix rotation bug when other controller is above the root
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
{
[[self.navigationController.viewControllers objectAtIndex:0] didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
- (void)addResult:(id)result
{
m_results.push_back(*[result get]);

View file

@ -101,6 +101,13 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
return YES;
}
// correctly pass rotation event up to the root mapViewController
// to fix rotation bug when other controller is above the root
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation
{
[[self.navigationController.viewControllers objectAtIndex:0] didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
TIndex const index = CalculateIndex(m_index, indexPath);