Search code examples
objective-cgoogle-mapsgoogle-street-view

google street view not showing


I have a view controller on it I've placed a UIView that should show a streetview when a button is clicked

GMSPanoramaView *streetView;

-(void) viewdidAppear
{
...
streetView = [[GMSPanoramaView alloc] initWithFrame: self.googleStreetView.frame];
    self.googleStreetView = streetView; //self.googleStreetView located on the view controller in story board design time
}
- (IBAction)openGoogleStreetView:(id)sender
{
    //initialize streetview
    [streetView moveNearCoordinate:CLLocationCoordinate2DMake(latitude, longitude)];
    [self.tableView bringSubviewToFront:self.googleStreetView];
}

Solution

  • I'll just post an answer here for the record.

    Doing self.googleStreetView = streetView; will just put the pointer of streetView to self.googleStreetView but will not add it to your UI.

    You need to add streetView as a subView of self.googleStreetView

    [self.googleStreetView addSubview:streetView];