Cannot put a google maps GMSMapView in a subview of main main view?

后端 未结 10 1047
遇见更好的自我
遇见更好的自我 2020-11-28 06:50

I\'m struggling with this problem! I want to add a google maps GMSMapView into a UIView that is only a portion of the main UIView of m

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 07:29

    (void)viewDidLoad {
        GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                            longitude:151.20
                                                                 zoom:14];
    
        GMSMarker *marker = [[GMSMarker alloc] init];
        marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
        marker.title = @"Sydney";
        marker.snippet = @"Australia";
        marker.map = self.mapContainerView;
    
        //set the camera for the map
        self.mapContainerView.camera = camera;
    
        self.mapContainerView.myLocationEnabled = YES;
    }
    

提交回复
热议问题