所以我使用的是xcode 6.2,我从制作应用程序开始。但是我有一个问题:每当我在我的故事板上拖动什么东西,比如导航条,地图就会覆盖它,它根本不会出现,请帮助。这是我的密码
#import "ViewController.h"
@interface ViewController () {
GMSMapView *mapView;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:43.642510 longitude:-79.387038 zoom:12 bearing:0 viewingAngle:0];
mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.myLocationEnabled = YES;
self.view = mapView;
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(43.642510, -79.387038);
marker.title = @"CN-Tower";
marker.snippet = @"A beautifull tower";
marker.map = mapView;
marker.opacity = 0.7;
}不管怎样,谢谢你,JP
发布于 2015-04-07 01:19:48
当您执行self.view = mapView时,您将视图控制器的根视图设置为映射--因此地图涵盖了所有内容,取代了您在故事板中设计的所有内容。
您需要做的是将地图添加为根视图的子视图(如以下几种方法):
Using the Google Maps SDK in views other than the main view
https://stackoverflow.com/questions/29471701
复制相似问题