ios7 - 如何在 Ios 中自动布局 Google map

标签 ios7 google-maps-sdk-ios

我是 ios 新手,正在尝试将 map 嵌入到我的应用程序中。我不希望 map 覆盖整个页面,而是寻找基于 ipad 旋转自动布局的方法。

GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];

Google只给出了一个例子来显示绘制矩形的 map ?我可以以其他方式显示 map 并保留自动布局吗?

最佳答案

今天就实现了每个人都可能需要的同样的东西:
使用PureLayout library像常规 UIView 一样布局 GMSMapView 非常容易。

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.delegate = self;
// This is important when we layout view with constraints
mapView_.translatesAutoresizingMaskIntoConstraints = NO;
mapView_.myLocationEnabled = YES;
[self.view addSubview:mapView_];

// Size to fit the screen with zero insets
[mapView_ autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];

您将在屏幕上看到全屏 map View 。当您旋转屏幕时它也会起作用。

关于ios7 - 如何在 Ios 中自动布局 Google map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21444828/

相关文章:

ios - 后台获取、NSURLSession GET 和本地通知

ios - 重新打开应用程序时,白色 UIStatusbar 会轻微闪烁?

iphone - 我的功能合并 2 张图片适用于 iOS 6,但现在返回的是 ios 7 的空图片

ios - 谷歌地图 - 本地图放大时让路线沿着街道

ios - 是否可以使用 iOS Google Maps SDK 检索路线的时间?

ios - 弹出 View 在设备中不起作用

ios - 初始化默认缩放

ios - Google MAP iOS 卫星 View 现在太阴了

ios - 如何在不点击标记的情况下在 iOS 谷歌地图中显示信息窗口?

ios - Google Maps iOS SDK 将 "My Location"按钮移至左下角