【问题标题】:Can not change currentPage property in UIPageControl无法更改 UIPageControl 中的 currentPage 属性
【发布时间】:2016-02-11 10:15:21
【问题描述】:
private func setupPageControl() {
    let appearance = UIPageControl.appearance()
    appearance.pageIndicatorTintColor = UIColor.grayColor()
    appearance.currentPageIndicatorTintColor = UIColor.whiteColor()
    appearance.backgroundColor = UIColor.darkGrayColor()
    appearance.currentPage = 2
}

我正在尝试更改 UIPageControl 在我的应用中的第一个位置,但我无法使用此代码获得适当的结果。

【问题讨论】:

  • currentPage 可以被访问为 pageControl.currentPage = pageControl 是 UIPageControl 出口的东西。

标签: swift uipagecontrol


【解决方案1】:

您正在尝试通过外观代理设置currentPage,这显然不起作用,也不应该起作用。

以与页面控件属性/变量相同的方式设置属性以使其工作。

要知道哪些选择器应该与外观代理一起工作,请检查类的 Objective-C 头文件并查找 UI_APPEARANCE_SELECTOR 属性

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    • 2019-01-31
    • 1970-01-01
    • 2022-11-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多