[iPhone] Viewport is saved between program terminations

This commit is contained in:
Alex Zolotarev 2011-03-03 18:36:21 +00:00 committed by Alex Zolotarev
parent 16cf51569c
commit a5ad666142
3 changed files with 20 additions and 1 deletions

View file

@ -40,4 +40,7 @@ withConfidenceRadius: (double) confidenceRadius
- (void) onResize: (GLint)width withHeight: (GLint)height;
- (void) onPaint;
// called when app is terminated by system
- (void) OnTerminate;
@end

View file

@ -74,7 +74,10 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
// to perform a proper resize
[(EAGLView*)self.view layoutSubviews];
m_framework->ShowAll();
// restore previous screen position
if (!m_framework->LoadState())
m_framework->ShowAll();
}
return self;
@ -295,4 +298,12 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
m_framework->SetOrientation(newOrientation);
}
- (void) OnTerminate
{
if (m_framework)
{ // save world rect for next launch
m_framework->SaveState();
}
}
@end

View file

@ -6,6 +6,11 @@
@synthesize window;
@synthesize mapViewController;
// here we're
- (void) applicationWillTerminate: (UIApplication *) application
{
[mapViewController OnTerminate];
}
- (void) applicationDidFinishLaunching: (UIApplication *) application
{