如何在ios应用中缩小谷歌地图的屏幕尺寸

如何在ios应用中缩小谷歌地图的屏幕尺寸,ios,iphone,objective-c,ios7,Ios,Iphone,Objective C,Ios7,在我的应用程序中,我加入了谷歌地图API,但问题是,它占据了整个屏幕,但我不希望它占据整个屏幕,因为我在同一屏幕上有其他UI控件。我把代码贴在下面 GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:12.9699 longitude:77.6499 zoom:6]; mapView_ = [GMSMapView mapWithFrame: CGRectMake(0,0, 10, 25) camera: camera

在我的应用程序中,我加入了谷歌地图API,但问题是,它占据了整个屏幕,但我不希望它占据整个屏幕,因为我在同一屏幕上有其他UI控件。我把代码贴在下面

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:12.9699 longitude:77.6499 zoom:6];
mapView_ = [GMSMapView mapWithFrame: CGRectMake(0,0, 10, 25) camera: camera];
mapView_.myLocationEnabled = YES;
NSLog(@"User's location: %@", mapView_.myLocation);
UIEdgeInsets mapInsets = UIEdgeInsetsMake(100.0,10.0,  10.0, 300.0);
mapView_.padding = mapInsets;
self.view = mapView_;

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(12.9699,77.6499);
marker.title = @"BANGALORE";
marker.snippet = @"IndraNagar";
marker.map = mapView_;

您应该替换
marker.map=mapView作为
[self.view addSubview:mapView_]

请参阅下面的代码

 GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude
                                                        longitude:locationManager.location.coordinate.longitude
                                                             zoom:16];

    mapView_ = [GMSMapView mapWithFrame:CGRectMake(0, 44, self.view.bounds.size.width, self.view.bounds.size.height-44) camera:camera];
    mapView_.myLocationEnabled = YES;
    [self.view addSubview:mapView_];

请尝试使用此代码,它对我有效:

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
                                                            longitude:longitude
                                                                 zoom:14];
    mapView = [GMSMapView mapWithFrame:mapViewContent.frame camera:camera];
    mapView.myLocationEnabled = YES;
    mapView.delegate = self;
    [mapViewContent addSubview:mapView];

mapViewContent
是您的自定义视图。

self.view=mapView代替此添加以下代码

UIView * MApBaseView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];// add your frame size here
    [self.view addSubview:MApBaseView];
    [MApBaseView addSubview: mapView_];

@用户3663506如果答案能解决您的问题,请接受它,以便它能帮助其他人