Change background color for page control

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

NOTE: i want to set background color as clear color

  • iOS Core Data when to save context?
  • Xcode 9 - Localization Issue Warning Storyboard
  • Localization of the iPhone Settings.bundle
  • Youtube integration in iOS SDK
  • Invalid update: invalid number of rows in section 0 terminating with uncaught exception of type NSException
  • Does it take 24 hours for custom events to be recorded in Parse Analytics
  • 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
    

    Thanks in advance.

    2 Solutions Collect From Internet About “Change background color for page control”

    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()
      }
    }
    

    @alexander-johmann above has a solution (though I’d like to find another way).

    Ideally it would be better to be able to set the actual background color. This solution doesn’t really do that; it removes elements of the UIPageControl to get the ‘effect’ of providing a clear background without actually doing so.

    Here is an objective-c version of the same code:

    for (UIView *subview in pageControl.subviews) {
        if ([subview isKindOfClass:[UIVisualEffectView class]] == YES) {
            [subview removeFromSuperview];
        }
    }