美文网首页iOS学习
将UIPageControl设置为图片的方法

将UIPageControl设置为图片的方法

作者: 伏特加 | 来源:发表于2016-02-22 11:45 被阅读1534次
    UIPageControl *pageControl = [[UIPageControl alloc] init];
    
    [pageControl setValue:[UIImage imageNamed:@"image1"] forKeyPath:@"_pageImage"];
    
    [pageControl setValue:[UIImage imageNamed:@"image2"] forKeyPath:@"_currentPageImage"];
    
    [self addSubview:pageControl];
    
    self.pageControl = pageControl;
    

    相关文章

      网友评论

      • 陈藩:修改之后,点与点之间的距离变得很宽怎么改呢?
        陈藩:@羽辰梦 - (void) setCurrentPage:(NSInteger)page {
        [super setCurrentPage:page];

        for (NSUInteger i =0; i < [self.subviews count]; i++) {
        UIView* dot = [self.subviews objectAtIndex:i];
        [dot setFrame:CGRectMake(dot.frame.origin.x, dot.frame.origin.y,18, 18)];
        if ([dot.subviews count] == 0) {
        UIImageView * view = [[UIImageView alloc]initWithFrame:dot.bounds];
        [dot addSubview:view];
        };
        UIImageView *imageView = dot.subviews[0];
        if (i == page) {
        imageView.image = [UIImage imageNamed:@"icon_point_sel"];
        } else {
        imageView.image = [UIImage imageNamed:@"icon_point_nor"];
        }
        dot.backgroundColor = [UIColor clearColor];
        }
        }
        羽辰梦:@古墓宅子 大神怎么修改的
        陈藩:已经修改好了
      • 健健锅:不管用啊
        陈藩:我修改之后是可以的啊

      本文标题:将UIPageControl设置为图片的方法

      本文链接:https://www.haomeiwen.com/subject/axlbkttx.html