diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index cfc3804590..842ec24bef 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -200,7 +200,7 @@ bool _inRepaint = false;
- (void)layoutSubviews
{
CGFloat const scale = self.contentScaleFactor;
- CGSize const s = self.frame.size;
+ CGSize const s = self.bounds.size;
[self onSize:s.width * scale withHeight:s.height * scale];
}
diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h
index 798a65eb29..5f0df9b34b 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.h
+++ b/iphone/Maps/Classes/MapsAppDelegate.h
@@ -10,7 +10,6 @@
NSInteger m_standbyCounter;
}
-@property (nonatomic, retain) IBOutlet UINavigationController * m_navigationController;
@property (nonatomic, retain) IBOutlet UIWindow * m_window;
@property (nonatomic, retain) IBOutlet MapViewController * m_mapViewController;
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm
index 1f12701074..6bb4112197 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.mm
+++ b/iphone/Maps/Classes/MapsAppDelegate.mm
@@ -6,7 +6,6 @@
@implementation MapsAppDelegate
-@synthesize m_navigationController;
@synthesize m_window;
@synthesize m_mapViewController;
@synthesize m_locationManager;
@@ -36,7 +35,7 @@
[Preferences setup:m_mapViewController];
m_locationManager = [[LocationManager alloc] init];
- [m_window addSubview:m_navigationController.view];
+ [m_window addSubview:m_mapViewController.view];
[m_window makeKeyAndVisible];
}
diff --git a/iphone/Maps/Classes/SearchVC.mm b/iphone/Maps/Classes/SearchVC.mm
index ab625d4e2c..87e2e63ca9 100644
--- a/iphone/Maps/Classes/SearchVC.mm
+++ b/iphone/Maps/Classes/SearchVC.mm
@@ -217,14 +217,6 @@ 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];
-// [self fixHeadingOrientation];
-//}
-
//**************************************************************************
//*********** SearchBar handlers *******************************************
- (void)searchBar:(UISearchBar *)sender textDidChange:(NSString *)searchText
diff --git a/iphone/Maps/MainWindow.xib b/iphone/Maps/MainWindow.xib
index 6b07a4d4fb..3e85a9f5df 100644
--- a/iphone/Maps/MainWindow.xib
+++ b/iphone/Maps/MainWindow.xib
@@ -11,15 +11,12 @@
933
- IBProxyObject
- IBUINavigationController
- IBUIViewController
- IBUICustomObject
- IBUIButton
IBUIWindow
- IBUINavigationBar
- IBUINavigationItem
+ IBUICustomObject
+ IBUIViewController
+ IBUIButton
IBUIView
+ IBProxyObject
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -40,162 +37,131 @@
-
@@ -387,9 +324,6 @@
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
EAGLView
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -408,7 +342,7 @@
- 212
+ 213
diff --git a/iphone/Maps/Resources-iPad/MainWindow-iPad.xib b/iphone/Maps/Resources-iPad/MainWindow-iPad.xib
index 176605b988..e115abbdde 100644
--- a/iphone/Maps/Resources-iPad/MainWindow-iPad.xib
+++ b/iphone/Maps/Resources-iPad/MainWindow-iPad.xib
@@ -11,15 +11,12 @@
933
- IBProxyObject
- IBUINavigationController
- IBUIViewController
- IBUICustomObject
- IBUIButton
IBUIWindow
- IBUINavigationBar
- IBUINavigationItem
+ IBUICustomObject
+ IBUIViewController
+ IBUIButton
IBUIView
+ IBProxyObject
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -46,6 +43,7 @@
{768, 1024}
+
1
MSAxIDEAA
@@ -58,152 +56,126 @@
YES
YES
-
-
- 2
+
+
+
+ 274
+
+
+
+ 268
+ {{20, 899}, {44, 44}}
+
+
+ _NS:237
+ NO
+ IBIPadFramework
+ 0
+ 0
+ 1
+
+ 3
+ MQA
+
+
+ 1
+ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
+
+
+ 3
+ MC41AA
+
+
+ NSImage
+ location-search.png
+
+
+ NSImage
+ location.png
+
+
+ Helvetica-Bold
+ Helvetica
+ 2
+ 15
+
+
+ Helvetica-Bold
+ 15
+ 16
+
+
+
+
+ 268
+ {{85, 899}, {44, 44}}
+
+
+ _NS:237
+ NO
+ IBIPadFramework
+ 0
+ 0
+ 1
+
+
+ 1
+ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
+
+
+
+ NSImage
+ search.png
+
+
+
+
+
+
+ 268
+ {{150, 899}, {44, 44}}
+
+ _NS:237
+ NO
+ IBIPadFramework
+ 0
+ 0
+ 1
+
+
+ 1
+ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
+
+
+
+ NSImage
+ downloader.png
+
+
+
+
+
+ {768, 960}
+
+
+
+ 3
+ MQA
+
+ 2
+
+
+ NO
+ YES
+ IBIPadFramework
+
1
1
IBIPadFramework
NO
-
-
- 256
- {0, 0}
- _NS:428
- YES
- YES
- IBIPadFramework
-
-
-
-
-
- 274
-
-
-
- 268
- {{20, 899}, {44, 44}}
-
-
- _NS:237
- NO
- IBIPadFramework
- 0
- 0
- 1
-
- 3
- MQA
-
-
- 1
- MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
-
-
- 3
- MC41AA
-
-
- NSImage
- location-search.png
-
-
- NSImage
- location.png
-
-
- Helvetica-Bold
- Helvetica
- 2
- 15
-
-
- Helvetica-Bold
- 15
- 16
-
-
-
-
- 268
- {{85, 899}, {44, 44}}
-
-
- _NS:237
- NO
- IBIPadFramework
- 0
- 0
- 1
-
-
- 1
- MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
-
-
-
- NSImage
- search.png
-
-
-
-
-
-
- 268
- {{150, 899}, {44, 44}}
-
- _NS:237
- NO
- IBIPadFramework
- 0
- 0
- 1
-
-
- 1
- MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
-
-
-
- NSImage
- downloader.png
-
-
-
-
-
- {{0, 64}, {768, 960}}
-
-
- 3
- MQA
-
- 2
-
-
- NO
- YES
- IBIPadFramework
-
-
-
- Map
- IBIPadFramework
-
-
-
- 1
- 1
-
- IBIPadFramework
- NO
-
-
@@ -220,25 +192,9 @@
rootViewController
-
-
- 184
-
-
-
- m_mapViewController
-
- 186
-
-
-
- m_navigationController
-
-
-
- 187
+ 197
@@ -248,6 +204,14 @@
188
+
+
+ m_mapViewController
+
+
+
+ 186
+
m_myPositionButton
@@ -314,58 +278,38 @@
-
- 179
-
-
-
-
-
-
-
-
- 180
-
-
-
126
-
-
+
Map View Controller
161
-
-
+
+
-
- 183
-
-
-
190
- 191
-
+ 192
+
- 192
-
+ 191
+
@@ -379,9 +323,6 @@
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
EAGLView
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -401,7 +342,7 @@
- 196
+ 197
diff --git a/iphone/Maps/Settings/CountriesViewController.mm b/iphone/Maps/Settings/CountriesViewController.mm
index cb5db56414..0d38b939e7 100644
--- a/iphone/Maps/Settings/CountriesViewController.mm
+++ b/iphone/Maps/Settings/CountriesViewController.mm
@@ -38,7 +38,6 @@ static NSInteger RowFromIndex(TIndex const & index)
return index.m_group;
}
-
static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
{
TIndex theirsFixed = theirs;
@@ -53,7 +52,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
@implementation CountriesViewController
-- (void) OnAboutButton:(id)sender
+- (void) onAboutButton:(id)sender
{
// display WebView with About text
NSString * text;
@@ -70,6 +69,11 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
[aboutViewController release];
}
+- (void) onCloseButton:(id)sender
+{
+ [[[MapsAppDelegate theApp] settingsManager] Hide];
+}
+
- (id) initWithStorage: (Storage &)storage andIndex: (TIndex const &) index andHeader: (NSString *)header
{
m_storage = &storage;
@@ -81,6 +85,13 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
UIBarButtonItem * aboutButton = [[[UIBarButtonItem alloc] initWithTitle:@"About" style: UIBarButtonItemStylePlain
target:self action:@selector(OnAboutButton:)] autorelease];
self.navigationItem.rightBarButtonItem = aboutButton;
+ // Show Close button only on the first page
+ if ([header compare:@"Download"] == NSOrderedSame)
+ {
+ UIBarButtonItem * closeButton = [[[UIBarButtonItem alloc] initWithTitle:@"Close" style: UIBarButtonItemStylePlain
+ target:self action:@selector(onCloseButton:)] autorelease];
+ self.navigationItem.leftBarButtonItem = closeButton;
+ }
}
return self;
}
@@ -102,13 +113,6 @@ 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);
diff --git a/iphone/Maps/Settings/SettingsManager.h b/iphone/Maps/Settings/SettingsManager.h
index 65bbeeac88..0563bc6b80 100644
--- a/iphone/Maps/Settings/SettingsManager.h
+++ b/iphone/Maps/Settings/SettingsManager.h
@@ -7,6 +7,7 @@ namespace storage { class Storage; }
@interface SettingsManager : NSObject
{
storage::Storage * m_storage;
+ UINavigationController * m_navigationController;
}
// TODO: Refactor SettingsManager.Show: remove storage.
diff --git a/iphone/Maps/Settings/SettingsManager.mm b/iphone/Maps/Settings/SettingsManager.mm
index 6eb122fe66..cf2025c7e2 100644
--- a/iphone/Maps/Settings/SettingsManager.mm
+++ b/iphone/Maps/Settings/SettingsManager.mm
@@ -5,7 +5,7 @@
#include "../../../storage/storage.hpp"
-#include
+#include "../../../std/bind.hpp"
using namespace storage;
@@ -14,19 +14,21 @@ using namespace storage;
- (void) dealloc
{
+ [m_navigationController release];
[super dealloc];
}
+
/// Get right controller from the stack
- (UIViewController *) ControllerByIndex:(TIndex const &)index
{
- NSArray * controllers = [[MapsAppDelegate theApp].m_navigationController viewControllers];
- if (index.m_region != TIndex::INVALID && [controllers count] >= 4)
- return [controllers objectAtIndex:3];
- else if (index.m_country != TIndex::INVALID && [controllers count] >= 3)
+ NSArray * controllers = m_navigationController.viewControllers;
+ if (index.m_region != TIndex::INVALID && [controllers count] >= 3)
return [controllers objectAtIndex:2];
- else if (index.m_group != TIndex::INVALID && [controllers count] >= 2)
+ else if (index.m_country != TIndex::INVALID && [controllers count] >= 2)
return [controllers objectAtIndex:1];
+ else if (index.m_group != TIndex::INVALID && [controllers count] >= 1)
+ return [controllers objectAtIndex:0];
return nil;
}
@@ -48,9 +50,11 @@ using namespace storage;
- (void) Show:(UIViewController *)prevController WithStorage:(Storage *)storage
{
m_storage = storage;
+
CountriesViewController * countriesController = [[[CountriesViewController alloc]
initWithStorage:*m_storage andIndex:TIndex() andHeader:@"Download"] autorelease];
- [[MapsAppDelegate theApp].m_navigationController pushViewController:countriesController animated:YES];
+ m_navigationController = [[UINavigationController alloc] initWithRootViewController:countriesController];
+ [prevController presentModalViewController:m_navigationController animated:YES];
// Subscribe to storage callbacks.
{
@@ -63,8 +67,7 @@ using namespace storage;
SEL progressSel = @selector(OnCountryDownload:withProgress:);
TProgressFunc progressImpl = (TProgressFunc)[self methodForSelector:progressSel];
- m_storage->Subscribe(boost::bind(changeImpl, self, changeSel, _1),
- boost::bind(progressImpl, self, progressSel, _1, _2));
+ m_storage->Subscribe(bind(changeImpl, self, changeSel, _1), bind(progressImpl, self, progressSel, _1, _2));
}
}
@@ -73,7 +76,8 @@ using namespace storage;
{
m_storage->Unsubscribe();
- [[MapsAppDelegate theApp].m_navigationController popToRootViewControllerAnimated:YES];
+ [m_navigationController dismissModalViewControllerAnimated:YES];
+ [m_navigationController release], m_navigationController = nil;
m_storage = nil;
}