//
// ViewController.m
// UIPageControl-翻页控制器
//
// Created by Liu,Wenbo(TBRD) on 2020/5/28.
// Copyright © 2020 Liu,Wenbo(TBRD). All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//初始化一个分页控制器
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
//设置控制器的背景颜色
pageControl.backgroundColor = [UIColor grayColor];
//设置页码的个数
pageControl.numberOfPages = 6;
//设置当前选中的页码
pageControl.currentPage = 3;
//设置当只有一页时,是否隐藏,默认为YES
pageControl.hidesForSinglePage = YES;
//设置所有页码的颜色
pageControl.pageIndicatorTintColor = [UIColor greenColor];
//设置当前选中页码的颜色
pageControl.currentPageIndicatorTintColor = [UIColor yellowColor];
[self.view addSubview:pageControl];
}
@end
UIPageControl分页控制器
最新推荐文章于 2020-10-19 19:59:43 发布