我有一个视图控制器我已经放置了一个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];
}
答案 0 :(得分:2)
我只是在这里发布答案以供记录。
执行self.googleStreetView = streetView;
只会将streetView
的指针放到self.googleStreetView
,但不会将其添加到您的用户界面。
您需要将streetView
添加为subView
self.googleStreetView
[self.googleStreetView addSubview:streetView];