更改页面控制的背景颜色 [英] Change background color for page control

查看:145
本文介绍了更改页面控制的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 tvOS 中更改页面控制的背景颜色?

Is there any way to change background color of page control in tvOS?

注意:我想要将背景颜色设置为清晰颜色

NOTE: i want to set background color as clear color

我已尝试以下代码,但它无法在 tvOS 中使用。

I have try the below code, but it is not working in tvOS.

var pageControl : UIPageControl!
pageControl = UIPageControl(frame: CGRectMake(0, self.view.frame.height - 200, self.view.frame.width, 50))
pageControl.pageIndicatorTintColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.70)
pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
pageControl.backgroundColor = UIColor.clearColor()
pageControl.opaque = false
pageControl.numberOfPages = 10
pageControl.currentPage = 0

谢谢提前。

推荐答案

此透明背景是UIVageControl中UIVisualEffectView类型的子视图。你可以这样删除它:

This transparent background is a subview in UIPageControl of type UIVisualEffectView. You could remove it like this:

for subview in pageControl.subviews {
  if subview.isKindOfClass(UIVisualEffectView) {
    subview.removeFromSuperview()
  }
}

这篇关于更改页面控制的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆