From a062fb71068e973a9f875bcfc4a511a65f02f4af Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Sun, 23 Oct 2011 02:54:13 +0300 Subject: [PATCH] [ios] Cleaned up Objective C code --- iphone/Maps/Classes/CompassView.h | 4 ---- iphone/Maps/Classes/CompassView.mm | 8 ++++---- iphone/Maps/Classes/EAGLView.h | 2 -- iphone/Maps/Classes/EAGLView.mm | 2 +- iphone/Maps/Classes/MapViewController.h | 3 --- iphone/Maps/Classes/MapViewController.mm | 8 ++------ iphone/Maps/Classes/MapsAppDelegate.h | 4 ---- iphone/Maps/Classes/SearchVC.h | 2 -- 8 files changed, 7 insertions(+), 26 deletions(-) diff --git a/iphone/Maps/Classes/CompassView.h b/iphone/Maps/Classes/CompassView.h index 58f728a195..7a6e0c687e 100644 --- a/iphone/Maps/Classes/CompassView.h +++ b/iphone/Maps/Classes/CompassView.h @@ -2,10 +2,6 @@ // Custom view which drows an arrow @interface CompassView : UIView -{ - float m_angle; -} // Rotation angle in radians (decart system) @property (nonatomic, assign) float angle; - @end diff --git a/iphone/Maps/Classes/CompassView.mm b/iphone/Maps/Classes/CompassView.mm index 5fa6dea45d..22f40f9996 100644 --- a/iphone/Maps/Classes/CompassView.mm +++ b/iphone/Maps/Classes/CompassView.mm @@ -2,7 +2,7 @@ @implementation CompassView -@synthesize angle = m_angle; +@synthesize angle; - (id)initWithFrame:(CGRect)frame { @@ -15,9 +15,9 @@ return self; } -- (void)setAngle:(float)angle +- (void)setAngle:(float)aAngle { - m_angle = angle; + angle = aAngle; [self setNeedsDisplay]; } @@ -38,7 +38,7 @@ [aPath closePath]; CGAffineTransform matrix = CGAffineTransformMakeTranslation(w2, w2); - matrix = CGAffineTransformRotate(matrix, -m_angle); + matrix = CGAffineTransformRotate(matrix, -angle); matrix = CGAffineTransformTranslate(matrix, -w2, -w2); [aPath applyTransform:matrix]; diff --git a/iphone/Maps/Classes/EAGLView.h b/iphone/Maps/Classes/EAGLView.h index 6687375a03..59781fa9ef 100644 --- a/iphone/Maps/Classes/EAGLView.h +++ b/iphone/Maps/Classes/EAGLView.h @@ -39,8 +39,6 @@ namespace yg shared_ptr windowHandle; shared_ptr drawer; shared_ptr renderBuffer; - - MapViewController * controller; } // Called as a result of invalidate on iphone::WindowHandle diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index e09b4e6c0e..cf0cb9f7ad 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -201,7 +201,7 @@ bool _inRepaint = false; { CGFloat const scale = self.contentScaleFactor; CGSize const s = self.frame.size; - [self.controller onResize:s.width * scale withHeight:s.height * scale]; + [controller onResize:s.width * scale withHeight:s.height * scale]; [self onSize:s.width * scale withHeight:s.height * scale]; } diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 2918525c02..c4efc7e25e 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -24,10 +24,7 @@ m2::PointD m_Pt1, m_Pt2; - UIButton * m_myPositionButton; NSTimer * m_iconTimer; - - bool m_mapIsVisible; } - (void) ZoomToRect: (m2::RectD const &) rect; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index c0dd89581a..34ea370a84 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -118,8 +118,6 @@ storage::Storage m_storage; { if ((self = [super initWithCoder:coder])) { - m_mapIsVisible = false; - [(EAGLView*)self.view setController : self]; shared_ptr windowHandle = [(EAGLView*)self.view windowHandle]; @@ -355,8 +353,8 @@ NSInteger compareAddress(id l, id r, void * context) - (void) OnEnterForeground { m_framework->EnterForeground(); - if (m_mapIsVisible) - [self Invalidate]; + if (self.isViewLoaded && self.view.window) + [self Invalidate]; // only invalidate when map is displayed on the screen } - (void)viewWillAppear:(BOOL)animated @@ -365,7 +363,6 @@ NSInteger compareAddress(id l, id r, void * context) // and orientation changes when mapVC is not visible [self.view layoutSubviews]; - m_mapIsVisible = true; [self Invalidate]; [self.navigationController setNavigationBarHidden:YES animated:YES]; [super viewWillAppear:animated]; @@ -373,7 +370,6 @@ NSInteger compareAddress(id l, id r, void * context) - (void)viewWillDisappear:(BOOL)animated { - m_mapIsVisible = false; m_framework->SetUpdatesEnabled(false); [self.navigationController setNavigationBarHidden:NO animated:YES]; [super viewWillDisappear:animated]; diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h index 7d838503ba..798a65eb29 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.h +++ b/iphone/Maps/Classes/MapsAppDelegate.h @@ -6,12 +6,8 @@ @interface MapsAppDelegate : NSObject { - UINavigationController * m_navigationController; - UIWindow * m_window; - MapViewController * m_mapViewController; SettingsManager * m_settingsManager; NSInteger m_standbyCounter; - LocationManager * m_locationManager; } @property (nonatomic, retain) IBOutlet UINavigationController * m_navigationController; diff --git a/iphone/Maps/Classes/SearchVC.h b/iphone/Maps/Classes/SearchVC.h index 06a802618c..4559ca8df8 100644 --- a/iphone/Maps/Classes/SearchVC.h +++ b/iphone/Maps/Classes/SearchVC.h @@ -21,8 +21,6 @@ typedef Framework framework_t; framework_t * m_framework; LocationManager * m_locationManager; vector m_results; - UISearchBar * m_searchBar; - UITableView * m_table; UILabel * m_warningView; /// Warning view shows only if this text is not nil NSString * m_warningViewText;