zoukankan      html  css  js  c++  java
  • UIPageControl的一些属性在ios6.0以下的使用

    测试项目时,在ios5.1.1以下的设备上总是出现错误,错误信息如下:

    [UIPageControl setCurrentPageIndicatorTintColor:]: unrecognized selector
                                            sent to instance

    而ios6.0以上的设备就没问题。

    经过查资料,才知道原来UIpageControl的currentPageIndicatorTintColor属性是在ios6.0以上的才有的。

    查看苹果api文档,可知,currentPageIndicatorTintColor--》Available in iOS 6.0 and later.   

    在ios6.0以下如果想改变小圆点的颜色,就得自己定义

    double version = [[UIDevicecurrentDevice].systemVersiondoubleValue];

        if(version - 6.0 <= 1e-8)

        {

            [self updateDots];

        }

     

    - (void) updateDots

    {

    if (imagePageStateNormal || imagePageStateHightlighted) {

    NSArray *subView = [pageControl.subviews retain];

     

    for (int i = 0; i < [subView count]; i++) {

    UIImageView *dot = [subView objectAtIndex:i];

    dot.image = (pageControl.currentPage == i ? imagePageStateHightlighted : imagePageStateNormal);

    }

            

            [subView release];

    }

    }

    在ios6.0以上如果想改变小圆点的颜色就可以直接使用

    pageControl.currentPageIndicatorTintColor = [UIColorgreenColor];

    pageControl.pageIndicatorTintColor = [UIColorgrayColor];

    这两行代码来改变小圆点选中和未选中的颜色

  • 相关阅读:
    “爆奇葩”项目之索引页
    android 的生命周期自我理解
    Jquery Mobile 中文API站
    根据两点经纬度计算距离
    sql语句查询经纬度范围
    Asp.net core 笔记
    Docker 笔记
    IOC和DI
    PHP学习笔记十、图像处理
    PHP学习笔记九、cookie与session
  • 原文地址:https://www.cnblogs.com/guatiantian/p/3421598.html
Copyright © 2011-2022 走看看