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

后端 未结 10 1039
遇见更好的自我
遇见更好的自我 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:30

    you can do it through IB

    .h
    @property (weak, nonatomic) IBOutlet GMSMapView *theMapView;
    
    .m
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
                                                            longitude:151.2086
                                                                 zoom:12];
    
    //This next line is not needed if you have a GMSMapView outlet
    //self.theMapView = [GMSMapView mapWithFrame:self.theMapView.frame camera:camera];
    self.theMapView.camera=camera;
    self.theMapView.mapType = kGMSTypeSatellite;
    self.theMapView.delegate=self;
    

提交回复
热议问题