1

I know this is already asked question but I tried all the solutions which is in that SO question but none of them worked so can any one tell me how to change frame of the google map my location button. I am using 1.13.23885.0 version of the google map.

1) Not working

    mapView = [[GMSMapView alloc] init];
    mapView.tag = Tag_googleMapView;
    mapView.frame = CGRectMake(0.0, 0.0, view.frame.size.width,view.frame.size.height);
    mapView.delegate = self;
    mapView.indoorEnabled = YES;

    [mapView setMyLocationEnabled:YES];
    [mapView.settings setMyLocationButton:YES];


    [view addSubview:mapView];
    [self setupOverviewMarker:view];


    [mapView setPadding:UIEdgeInsetsMake(70.0, 10.0, 0.0, 0.0)];

2) Not Working

for (UIView *object in mapView.subviews) {
        if([[[object class] description] isEqualToString:@"GMSUISettingsView"] )
        {
            for(UIView *view in object.subviews) {
                if([[[view class] description] isEqualToString:@"GMSx_QTMButton"] ) {
                    CGRect frame = view.frame;
                    frame.origin.y = 0.0;
                    view.frame = frame;
                }
            }
        }
    }

    [mapView updateConstraintsIfNeeded];
    [mapView layoutIfNeeded];

Is it possible in new SDK?

Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
  • where u want to put button? – Jigar Apr 11 '16 at 08:08
  • @DarjiJigar it is google map in build functionality. I am not putting button any where – Chirag Shah Apr 11 '16 at 08:50
  • try this code GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-37.81969 longitude:144.966085 zoom:4]; _mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; _mapView.settings.myLocationButton = YES; _mapView.myLocationEnabled = YES; _mapView.padding = UIEdgeInsetsMake(0, 0, kOverlayHeight, 0); self.view = _mapView; – Jigar Apr 11 '16 at 09:02
  • I already doing this please look in to my question – Chirag Shah Apr 11 '16 at 09:13

2 Answers2

1

Please try this step:

Only change line swaping:

Current:
[mapView setMyLocationEnabled:YES];
[mapView.settings setMyLocationButton:YES];


Chnages:
[mapView.settings setMyLocationButton:YES];
[mapView setMyLocationEnabled:YES];
Bhadresh Kathiriya
  • 3,147
  • 2
  • 21
  • 41
0

I know its very late, but it may help someone else. just provide padding to your map using UIEdgeInsets as

googleMap.Padding = new UIEdgeInsets(top: 0, left: 0, bottom: 60, right: 0);

or use this

for (UIView *object in mapView_.subviews) {
    if([[[object class] description] isEqualToString:@"GMSUISettingsView"] )
    {
        for(UIView *view in object.subviews) {
            if([[[view class] description] isEqualToString:@"GMSx_QTMButton"] ) {
                CGRect frame = view.frame;
                frame.origin.y -= 60;
                view.frame = frame;
            }
        }

    }
};
Narendra Sharma
  • 549
  • 4
  • 15