How to set the frame for mapview - in google GMSMap for iOS6

后端 未结 5 1444
青春惊慌失措
青春惊慌失措 2020-12-11 07:47

I am trying to load places inside Google Map View for iOS6. How to set the frame for the Map ? Currently it is fullscreen

 -(void)loadView {

   GMSCameraPos         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 08:00

    I don't think loadView is called when you are using a xib. I haven't tried using the Google Maps SDK for iOS with a xib, as I create all of my views programmatically.

    Maybe you could add your map view in viewDidLoad? So for example:

    - (void)viewDidLoad 
    {
        [super viewDidLoad];
    
        GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:10.00989
                                                        longitude:76.316142
                                                             zoom:15];
        mapView_ = [GMSMapView 
            mapWithFrame: CGRectMake(
                0, 0, 
                self.newView.frame.size.width, self.newView.frame.size.height)               
            camera: camera];
    
       [self.newView addSubview: mapView_];
    }
    

提交回复
热议问题