繁体   English   中英

为什么此警报未显示在我的iOS应用程序上?

[英]Why doesn't this alert show up on my iOS app?

以下代码在我的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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM