在Google地图ios中更改我的位置按钮位置 [英] Change my location button position in google map ios

查看:146
本文介绍了在Google地图ios中更改我的位置按钮位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是已经被问过的问题,但我尝试了所有解决方案,但是没有一个能够工作,因此任何人都可以告诉我如何更改Google地图我的位置按钮的框架。我使用1.13.23885.0版本的Google地图。



1)不工作

  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];


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


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



<2>不工作

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

[mapView updateConstraintsIfNeeded];
[mapView layoutIfNeeded];

新SDK中可以使用吗?

解决方案

请尝试以下步骤:



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


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


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?

解决方案

Please try this step:

Only change line swaping:

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


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

这篇关于在Google地图ios中更改我的位置按钮位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆