谷歌街景未显示

时间:2015-07-13 13:20:31

标签: objective-c google-maps google-street-view

我有一个视图控制器我已经放置了一个UIView,当点击一个按钮时应显示街景视图

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];
}

1 个答案:

答案 0 :(得分:2)

我只是在这里发布答案以供记录。

执行self.googleStreetView = streetView;只会将streetView的指针放到self.googleStreetView,但不会将其添加到您的用户界面。

您需要将streetView添加为subView

self.googleStreetView
[self.googleStreetView addSubview:streetView];