您的位置:首页 > 产品设计 > UI/UE

IOS--UIPageControl的使用方法详细

2014-12-06 09:17 591 查看

IOS--UIPageControl的使用方法详细

// UIPageControl的常用方法

UIPageControl *onePageControl = [[UIPageControl alloc] init];

onePageControl.frame = CGRectMake(10, 100, 300, 30); // 设置位置

onePageControl.backgroundColor = [UIColor redColor]; // 设置背景色

onePageControl.pageIndicatorTintColor = [UIColor whiteColor]; // 未选中的点的颜色

onePageControl.currentPageIndicatorTintColor = [UIColor blueColor]; // 选中的点的颜色

onePageControl.currentPage = 2; // 当前第几个点 默认0

onePageControl.hidesForSinglePage = YES; // 如果页面只有1个的时候,指示器自动消失

onePageControl.defersCurrentPageDisplay = NO; // 当你改变页面时,指示器是不会改变的,只有当你给updateCurrentPageDisplay发送消息才会改变现实, 默认是NO

onePageControl.numberOfPages = 8; // 设置总共有多少个小点,也就是有多少个页面

[self.view addSubview:onePageControl]; // 添加到View上

[onePageControl release], onePageControl = nil; // 释放内存
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: