以下代码在我的ViewController实现中,第一个块是Google Maps集成,第二个块是警报。编译器没有抛出任何错误。为什么我的警报没有出现?
-(void) loadView {
GMSCameraPosition * camera = [GMSCameraPosition cameraWithLatitude: 51.50
longitude: -0.11
zoom: 15
];
GMSMapView * mapView = [GMSMapView mapWithFrame: CGRectZero camera: camera];
mapView.mapType = kGMSTypeTerrain;
UIEdgeInsets mapInsets = UIEdgeInsetsMake(100.0, 0.0, 0.0, 300.0);
mapView.padding = mapInsets;
NSLog(@ "User's location: %@", mapView.myLocation);
mapView.myLocationEnabled = YES;
self.view = mapView;
// Creates a marker in the center of the map.
GMSMarker * marker = [
[GMSMarker alloc] init
];
marker.position = CLLocationCoordinate2DMake(51.50, -0.11);
marker.title = @ "London innit";
marker.snippet = @ "UK";
marker.map = mapView;
UIAlertController * alert = [UIAlertController alertControllerWithTitle: @ "My Alert"
message: @ "This is an alert."
preferredStyle: UIAlertControllerStyleAlert
];
UIAlertAction * defaultAction = [UIAlertAction actionWithTitle: @ "OK"
style: UIAlertActionStyleDefault
handler: ^ (UIAlertAction * action) {}
];
[alert addAction: defaultAction];
[self presentViewController: alert animated: YES completion: nil];
}
@end