首页 > 解决方案 > 更改导航栏和取消 google cast 视图的按钮

问题描述

我已经在我的项目中实现了 google cast 框架并开始对 google cast 视图进行主题化。

目前我有这段代码:

let castStyle = GCKUIStyle.sharedInstance()

//DeviceChooser
castStyle.castViews.deviceControl.deviceChooser.backgroundColor = theme.googleCastDeviceChooserBackgroundColor
castStyle.castViews.deviceControl.deviceChooser.iconTintColor = theme.googleCastDeviceChooserIconTintColor
castStyle.castViews.deviceControl.deviceChooser.headingTextColor = theme.googleCastDeviceChooserHeadingTextColor
castStyle.castViews.deviceControl.deviceChooser.captionTextColor = theme.googleCastDeviceChooserCaptionTextColor
castStyle.castViews.deviceControl.deviceChooser.headingTextFont = theme.googleCastDeviceChooserHeadingTextFont
castStyle.castViews.deviceControl.deviceChooser.captionTextFont = theme.googleCastDeviceChooserCaptionTextFont

UINavigationBar.appearance().barTintColor = theme.googleCastNavigationBarBackgroundColor
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().tintColor = UIColor.red
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: theme.googleCastNavigationBarIconTintColor]
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .selected)

castStyle.apply()

我仍然对设备选择器的样式有一些问题:

标签: iosswiftiphonegoogle-castgoogle-cast-sdk

解决方案


推荐阅读