Access the UIPageControl created by iOS6 UIPageViewController?

后端 未结 8 1040
盖世英雄少女心
盖世英雄少女心 2021-01-05 02:42

I\'m using a UIPageViewController with Navigation set to Horizontal, Transition Style set to Scroll (in InterfaceBuilder), and no spine. Which gives me a lovely

8条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 02:48

    In Swift:

        let subviews: Array = self.pageViewController.view.subviews
        var pageControl: UIPageControl! = nil
    
        for (var i = 0; i < subviews.count; i++) {
            if (subviews[i] is UIPageControl) {
                pageControl = subviews[i] as! UIPageControl
                break
            }
        }
    

提交回复
热议问题