如何将myLocation按钮设置为iOS的Google Maps上的右上角



我已经在ViewController中实现了Google Maps,并具有以下代码:

self.mapView.settings.myLocationButton = YES;
mapView.myLocationEnabled = YES;
mapView.mapType = kGMSTypeNormal;
mapView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view = [[UIView alloc] initWithFrame:CGRectZero];
[self.view addSubview:mapView];

我还想在Bottommost位置上添加另一个关于MapView的子视图,但它没有得到外交:

UIView *holder = [[UIView alloc] initWithFrame:CGRectMake(320, 568, 0, 120)];
holder.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
holder.backgroundColor =
[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
[self.view addSubview:holder];

预先感谢

我认为您对CGRectMake有些困惑。第一个论点是x,第二个是y,第三个是宽度和最后一个高度。所以,你在说

CGRectMake(320, 568, 0, 120)

是" 在右下角做出矩形,给它一个零宽度,并使其高120分"。这是否有意义,或者您需要有关坐标的更多帮助?

最新更新