Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions GMSMapView+Additions.m
Original file line number Diff line number Diff line change
Expand Up @@ -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