UIPageViewController page control background color

后端 未结 9 1329
一个人的身影
一个人的身影 2020-12-13 00:23

i\'m using UIPageViewController in my app and it\'s working fine. however, it\'s page control which has been added automatically has a black background which is hiding the c

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 00:45

    Here is the Swift 2+ version of Yas-T's Answer

    //In AppDelegate
    let pageControl = UIPageControl.appearance()
    pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
    pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
    pageControl.backgroundColor = UIColor.blueColor()
    
    //Or in your ViewController (Only available on IOS 9.0)
    if #available(iOS 9.0, *) {
       let pageControl = UIPageControl.appearanceWhenContainedInInstancesOfClasses([ViewController.self])
       pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
       pageControl.currentPageIndicatorTintColor = UIColor.darkGrayColor()
    }
    

提交回复
热议问题