diff --git a/iphone/Maps/Classes/MapViewController.hpp b/iphone/Maps/Classes/MapViewController.hpp index b5603fd01b..9ba43d7bda 100644 --- a/iphone/Maps/Classes/MapViewController.hpp +++ b/iphone/Maps/Classes/MapViewController.hpp @@ -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 diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 6708d89ab8..3d7708255f 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -74,7 +74,10 @@ typedef FrameWork 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 diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index e937805929..d869497a42 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -6,6 +6,11 @@ @synthesize window; @synthesize mapViewController; +// here we're +- (void) applicationWillTerminate: (UIApplication *) application +{ + [mapViewController OnTerminate]; +} - (void) applicationDidFinishLaunching: (UIApplication *) application {