google 街景未显示
google street view not showing
我上面有一个视图控制器我已经放置了一个 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];
}
我只是 post 在这里回答以供记录。
执行 self.googleStreetView = streetView;
只会将 streetView
的指针指向 self.googleStreetView
但不会将其添加到您的 UI.
您需要添加 streetView
作为 subView
的 self.googleStreetView
[self.googleStreetView addSubview:streetView];
我上面有一个视图控制器我已经放置了一个 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];
}
我只是 post 在这里回答以供记录。
执行 self.googleStreetView = streetView;
只会将 streetView
的指针指向 self.googleStreetView
但不会将其添加到您的 UI.
您需要添加 streetView
作为 subView
的 self.googleStreetView
[self.googleStreetView addSubview:streetView];