我是 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/