UIPageControl - How to make the background transparent?

后端 未结 8 2644
無奈伤痛
無奈伤痛 2021-02-18 21:30

I am using UIPageControl and trying to make the background transparent.

UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageInd         


        
8条回答
  •  逝去的感伤
    2021-02-18 22:14

    Okay, as mentioned by @powerj1984 and @daniellarsson UIPageControl seems to be not alterable with respect to position and background color.

    So I decided to move this to UIViewController and created a UIPageControl and

    @property (weak, nonatomic) IBOutlet UIPageControl *pageControl;
    

    And then bring this to top of my UIPageViewController as in viewDidLoad

    self.pageControl.numberOfPages = self.pageTitles.count;    
    [self.view addSubview:_pageControl.viewForBaselineLayout]; 
    

    Then I updated the index of UIPageControl in viewControllerBeforeViewController and viewControllerAfterViewController

    NSUInteger index = ((HomePageContentViewController*) viewController).pageIndex; 
    self.pageControl.currentPage = index;
    

提交回复
热议问题