gpt4 book ai didi

ios - 如何在 ViewController 中设置 Google Maps 应用程序的大小?

转载 作者:行者123 更新时间:2023-12-01 19:55:40 25 4
gpt4 key购买 nike

我开始了一个全新的 Single View 项目,其中只集成了 Google Maps SDK。

现在它跨越了整个屏幕(全尺寸),我相信这是默认设置。我想减少它,这样它就不会占用顶部栏的空间,我还想在底部为按钮留出空间。我该怎么做?

这是在我的(单个) View Controller 类中实现的唯一方法:

- (void)loadView {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.myLocationEnabled = YES;
self.view = mapView;

// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView;
}

最佳答案

1)Add a UIView into the ViewController where you want and set your custom size
2)set it's type to be GMSMapView in IdentityInspector

.H 文件中的 delcare IBOutlet
@property (weak, nonatomic) IBOutlet GMSMapView *map1;

.M
- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285
longitude:103.848
zoom:12];
self.map1.camera = camera;
self.map1.delegate=self;
self.map1.accessibilityElementsHidden = NO;
self.map1.indoorEnabled = NO;
self.map1.settings.myLocationButton = YES;
dispatch_async(dispatch_get_main_queue(), ^{
self.map1.myLocationEnabled = YES;
});
}

查看此博客 http://vikrambahl.com/google-maps-ios-xcode-storyboards/

关于ios - 如何在 ViewController 中设置 Google Maps 应用程序的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42784690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com