要在应用程序中显示带有 chromecasting 视频控件的迷你 View ,需要以编程方式更改 Root View 。需要将以下代码添加到 Storyboard 中。
// Wrap main view in the GCKUICastContainerViewController and display the mini controller.
UIStoryboard *appStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *navigationController =
[appStoryboard instantiateViewControllerWithIdentifier:@"MainNavigation"];
GCKUICastContainerViewController *castContainerVC =
[[GCKCastContext sharedInstance] createCastContainerControllerForViewController:navigationController];
castContainerVC.miniMediaControlsItemEnabled = YES;
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.rootViewController = castContainerVC;
但是我制作了 tabbar controller app,rootview 从 storyboard 开始。有人可以帮我更改或修改 rootview 以在 tabbar 应用程序中获取 miniView(容器 View )吗?
最佳答案
在使用选项卡 View 时更改 Root View 对我来说并不是强制性的,只需尝试在选项卡上添加完整的 navigationController 对象本身。 通过这种方式,在任何一个选项卡上都会有带有控件的迷你 View 。
关于ios - Storyboard iOS 中的 Chromecast miniview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57722173/