這裏是我的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