Search code examples
iosobjective-cgoogle-maps-sdk-iosgoogle-street-view

Google Maps iOS SDK - Add GMSPanoramaView in a SubView


I'm trying to add a GMSPanoramaView to a SubView. Here is the code I'm working on :

panoView_ = [[GMSPanoramaView alloc] initWithFrame:CGRectZero];
panoView_.delegate = self;
self.view = panoView_;


[panoView_ moveNearCoordinate:CLLocationCoordinate2DMake(emplLatitude, emplLongitude)];

This code renders the panorama on fullscreen mode.

If I try this, nothing happens :

self.myView = panoView_;

Where myView outlet is set in my storyboard.

This stack is a possible duplicate of this one which never got answered.

Help appreciated :)


Solution

  • Works when panoView_ is NOT inited with CGRectZero

    panoView_ = [[GMSPanoramaView alloc] initWithFrame:CGRectMake(200, 200, 400, 400)];
    
    self.myView.frame = panoView_.frame;
    [self.myView addSubview:panoView_];