From 3fa05774a376b7c0093b078a3a2e314064881154 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Wed, 26 Sep 2012 13:29:01 +0300 Subject: [PATCH] [ios] Minor codestyle fixes --- iphone/Maps/Bookmarks/BalloonView.mm | 19 ++++++-------- iphone/Maps/Classes/MapViewController.h | 2 +- iphone/Maps/Classes/MapViewController.mm | 30 +++++++++++----------- iphone/Maps/MainWindow.xib | 28 ++++++++++++-------- iphone/Maps/Maps.xcodeproj/project.pbxproj | 2 +- 5 files changed, 42 insertions(+), 39 deletions(-) diff --git a/iphone/Maps/Bookmarks/BalloonView.mm b/iphone/Maps/Bookmarks/BalloonView.mm index 8fa0972dc8..c43ec2b5d4 100644 --- a/iphone/Maps/Bookmarks/BalloonView.mm +++ b/iphone/Maps/Bookmarks/BalloonView.mm @@ -37,6 +37,14 @@ isDisplayed = NO; m_target = target; m_selector = selector; + m_titleView = [[UIImageView alloc] init]; + m_titleView.userInteractionEnabled = YES; + UITapGestureRecognizer * recognizer = [[[UITapGestureRecognizer alloc] + initWithTarget:m_target action:m_selector] autorelease]; + recognizer.numberOfTapsRequired = 1; + recognizer.numberOfTouchesRequired = 1; + recognizer.delaysTouchesBegan = YES; + [m_titleView addGestureRecognizer:recognizer]; } return self; } @@ -112,20 +120,9 @@ - (void) showButtonsInView:(UIView *)view atPoint:(CGPoint)pt { - [m_titleView release]; - m_titleView = [[UIImageView alloc] initWithImage:[self createPopupImageWithName:self.title andAddress:self.description]]; CGSize const s = m_titleView.bounds.size; m_titleView.frame = CGRectMake(pt.x, pt.y, 1, 1); - m_titleView.userInteractionEnabled = YES; - UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] - initWithTarget:m_target action:m_selector]; - recognizer.numberOfTapsRequired = 1; - recognizer.numberOfTouchesRequired = 1; - recognizer.delaysTouchesBegan = YES; - [m_titleView addGestureRecognizer:recognizer]; - [recognizer release]; - [view addSubview:m_titleView]; // Animate balloon from touched point diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 537f3b92f2..e43034ce6e 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -36,7 +36,7 @@ - (IBAction)OnSearchClicked:(id)sender; - (IBAction)OnBookmarksClicked:(id)sender; --(BOOL)OnProcessURL:(NSString*)url; +-(BOOL) OnProcessURL:(NSString*)url; @property (nonatomic, retain) IBOutlet UIButton * m_myPositionButton; @property (nonatomic, retain) IBOutlet UIButton * m_searchButton; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 22e43e9aec..728dda706a 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -27,7 +27,7 @@ //******************************************************************************************** //*********************** Callbacks from LocationManager ************************************* -- (void)onLocationStatusChanged:(location::TLocationStatus)newStatus +- (void) onLocationStatusChanged:(location::TLocationStatus)newStatus { GetFramework().OnLocationStatusChanged(newStatus); switch (newStatus) @@ -64,12 +64,12 @@ } } -- (void)onGpsUpdate:(location::GpsInfo const &)info +- (void) onGpsUpdate:(location::GpsInfo const &)info { GetFramework().OnGpsUpdate(info); } -- (void)onCompassUpdate:(location::CompassInfo const &)info +- (void) onCompassUpdate:(location::CompassInfo const &)info { GetFramework().OnCompassUpdate(info); } @@ -114,7 +114,7 @@ [navC release]; } -- (void)onBookmarkClicked +- (void) onBalloonClicked { PlacePageVC * placePageVC = [[PlacePageVC alloc] initWithBalloonView:m_bookmark]; [self.navigationController pushViewController:placePageVC animated:YES]; @@ -224,7 +224,7 @@ NSInteger compareAddress(id l, id r, void * context) return l < r; } -- (void)updatePointsFromEvent:(UIEvent*)event +- (void) updatePointsFromEvent:(UIEvent*)event { NSSet * allTouches = [event allTouches]; @@ -247,13 +247,13 @@ NSInteger compareAddress(id l, id r, void * context) } } -- (void)updateDataAfterScreenChanged +- (void) updateDataAfterScreenChanged { if (m_bookmark.isDisplayed) [m_bookmark updatePosition:self.view atPoint:[self globalPoint2ViewPoint:m_bookmark.globalPosition]]; } -- (void)stopCurrentAction +- (void) stopCurrentAction { switch (m_CurrentAction) { @@ -272,7 +272,7 @@ NSInteger compareAddress(id l, id r, void * context) [self updateDataAfterScreenChanged]; } -- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event +- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { // To cancel single tap timer if (((UITouch *)[touches anyObject]).tapCount > 1) @@ -297,7 +297,7 @@ NSInteger compareAddress(id l, id r, void * context) m_isSticking = true; } -- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event +- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { m2::PointD const TempPt1 = m_Pt1; m2::PointD const TempPt2 = m_Pt2; @@ -346,7 +346,7 @@ NSInteger compareAddress(id l, id r, void * context) [self updateDataAfterScreenChanged]; } -- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event +- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { [self updatePointsFromEvent:event]; [self stopCurrentAction]; @@ -372,7 +372,7 @@ NSInteger compareAddress(id l, id r, void * context) [self updateDataAfterScreenChanged]; } -- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event +- (void) touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { [self updatePointsFromEvent:event]; [self stopCurrentAction]; @@ -385,13 +385,13 @@ NSInteger compareAddress(id l, id r, void * context) return YES; // We support all orientations } -- (void)didReceiveMemoryWarning +- (void) didReceiveMemoryWarning { GetFramework().MemoryWarning(); [super didReceiveMemoryWarning]; } -- (void)viewDidUnload +- (void) viewDidUnload { // to correctly release view on memory warnings self.m_myPositionButton = nil; @@ -432,7 +432,7 @@ NSInteger compareAddress(id l, id r, void * context) [self Invalidate]; // only invalidate when map is displayed on the screen } -- (void)viewWillAppear:(BOOL)animated +- (void) viewWillAppear:(BOOL)animated { [self Invalidate]; // Update popup bookmark position @@ -440,7 +440,7 @@ NSInteger compareAddress(id l, id r, void * context) [super viewWillAppear:animated]; } -- (void)viewWillDisappear:(BOOL)animated +- (void) viewWillDisappear:(BOOL)animated { GetFramework().SetUpdatesEnabled(false); [super viewWillDisappear:animated]; diff --git a/iphone/Maps/MainWindow.xib b/iphone/Maps/MainWindow.xib index fc925ea9c7..c6b42a2548 100644 --- a/iphone/Maps/MainWindow.xib +++ b/iphone/Maps/MainWindow.xib @@ -2,20 +2,20 @@ 1024 - 11D50 - 2182 - 1138.32 - 568.00 + 12C54 + 2840 + 1187.34 + 625.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 + 1926 - IBUICustomObject - IBUIViewController - IBUIButton - IBUIView IBProxyObject + IBUIButton + IBUICustomObject + IBUIView + IBUIViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -47,6 +47,7 @@ 268 {{10, 435}, {40, 40}} + _NS:222 NO @@ -95,6 +96,7 @@ 268 {{110, 435}, {40, 40}} + _NS:222 NO @@ -124,6 +126,8 @@ 268 {{160, 435}, {40, 40}} + + _NS:222 NO NO @@ -152,6 +156,7 @@ 268 {{60, 435}, {40, 40}} + _NS:222 NO @@ -179,6 +184,7 @@ {{0, 20}, {320, 480}} + 1 @@ -494,7 +500,7 @@ com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 @@ -513,6 +519,6 @@ {48, 48} {48, 48} - 1181 + 1926 diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index a752094906..21350f3d5e 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -2124,7 +2124,6 @@ 29B97314FDCFA39411CA2CEA /* Maps */ = { isa = PBXGroup; children = ( - FA9EFCBE1609E150002D6195 /* Default-568h@2x.png */, FA36B8011540388B004560CC /* Bookmarks */, FA34BEC71338D6DB00FFB2A7 /* Common */, FA6E1F1B124E6B2800F59149 /* Platform */, @@ -2193,6 +2192,7 @@ EEAF65E4134BCBD500A81C82 /* location-search@2x.png */, 49B3FB8B132FA43E00057053 /* location.png */, 49B3FB8C132FA43E00057053 /* location@2x.png */, + FA9EFCBE1609E150002D6195 /* Default-568h@2x.png */, FA065FFD1286167A00FEA989 /* Default@2x.png */, FA065FFE1286167A00FEA989 /* Default.png */, 28AD73870D9D96C1002E5188 /* MainWindow.xib */,