【发布时间】:2013-02-25 06:04:50
【问题描述】:
我尝试使用 GoogleMapsSDKDemos 中的代码将地图视图调整为屏幕上较小的矩形,但似乎没有任何效果。这是我的代码:
mapView = [[GMSMapView alloc] initWithFrame:CGRectZero]; mapView.camera = [GMSCameraPosition cameraWithLatitude:38.98549782690282 经度:-76.94636067188021 缩放:17];
self.view = [[UIView alloc] initWithFrame:CGRectZero];
mapView.autoresizingMask =
UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
mapView.frame = self.view.frame;
mapView.clipsToBounds = YES;
mapView.myLocationEnabled = YES;
mapView.settings.tiltGestures = NO;
mapView.settings.zoomGestures = NO;
mapView.frame = CGRectMake(0,0, 10, 25);
[self.view addSubview:self.mapView];
倒数第二行似乎应该将 MapView 限制为一个小方块,但它仍然占据了整个屏幕。
【问题讨论】:
标签: ios objective-c view resize google-maps-sdk-ios