我已经在我的项目中实现了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()
devicechooser的样式仍然存在一些问题:
-
导航栏取消按钮未更改颜色 ->导航栏的背景色确实更改为正确的颜色。
-
似乎没有找到一种样式化表格视图的分隔符颜色的方法。