From ea94ddeeeff22e784f2aa1009bdeb9b853622a8d Mon Sep 17 00:00:00 2001 From: Ariel Tkachenko Date: Tue, 16 Dec 2014 00:36:43 +0200 Subject: [PATCH] Fixed for version 1.9.1 of the Google Maps SDK. Improved portability by switching from frameHeight to CGRectGetHeight macro --- GMSMapView+Additions.m | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/GMSMapView+Additions.m b/GMSMapView+Additions.m index 5cdd341..59071db 100644 --- a/GMSMapView+Additions.m +++ b/GMSMapView+Additions.m @@ -8,32 +8,37 @@ #import "GMSMapView+Additions.h" + @implementation GMSMapView (Additions) - (UIButton *)myLocationButton { NSMutableArray *buttons = [NSMutableArray new]; for (UIView *object in self.subviews) { - if([[[object class] description] isEqualToString:@"GMSUISettingsView"] ) - { - for(UIView *view in object.subviews) { - if([[[view class] description] isEqualToString:@"UIButton"] ) { + if ([[[object class] description] isEqualToString:@"GMSUISettingsView"]) { + for (UIView *view in object.subviews) { + //GMSx_QTMButton + if ([[[view class] description] isEqualToString:@"GMSx_QTMButton"]) { [buttons addObject:view]; } } } }; + if (buttons.count == 1) { + return buttons[0]; + } + if (buttons.count == 2) { UIButton *button_1 = [buttons objectAtIndex:0]; UIButton *button_2 = [buttons objectAtIndex:1]; - return button_1.frameHeight > button_2.frameHeight ? button_1 : button_2; - } else { - NSLog(@"UPDATING GOOGLE MAPS MIGHT HAVE BROKEN THE LOCATION BUTTON. CHECK IF IT HAS THE CORRECT IMAGE ON PRESSED STATE!"); - - return nil; + return CGRectGetHeight(button_1.frame) > CGRectGetHeight(button_2.frame) ? button_1 : button_2; } + + NSLog(@"UPDATING GOOGLE MAPS MIGHT HAVE BROKEN THE LOCATION BUTTON. CHECK IF IT HAS THE CORRECT IMAGE ON PRESSED STATE!"); + + return nil; } @end