这里是我的ViewController实现:简单的Google地图应用 - 如何调整容器大小?
@implementation ViewController
-
(void) viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-
(void) didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-
(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;
}
@end
我如何可以调整这个窗口,因为现在它跨越整个屏幕?我希望它更小,因此它适合位于顶部状态栏下方的较小的框中。
对于最后一个,[testView addSubview:mapView] ;,我的编译器表示使用未声明的标识符“testView”。 – nincs12
我的错误用yourview替换它 – Developer
感谢它编译。但是,现在它只是一个空白的白屏(谷歌地图不加载)。 – nincs12