• 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];

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

  • 相关阅读:
    Linux基础-yum软件包管理
    Linux基础-rpm软件包管理
    Linux基础-简单的进程操作
    Linux基础-free窥内存-dd探硬盘
    Linux基础-swap交换分区
    Linux基础-软硬连接Block概念
    Linux基础操作-分区概念
    Linux基础-vim编辑器
    Linux基础操作命令-打包压缩
    RandomAccessFile 文件读写中文乱码解决方案!
  • 原文地址:https://www.cnblogs.com/guatiantian/p/3421598.html
Copyright © 2020-2023  润新知