竖着显示的“UIPageControl”
来源:互联网 发布:《梦里花落知多少》txt 编辑:程序博客网 时间:2024/04/29 09:09
竖着显示的“UIPageControl”,其实是自己封装的一个UIButton
原理:根据传入的page的个数利用for循环创建UIButton,默认的都是灰色!再创建一个红色UILabel,滑动scroll的时候,让UILabel跟着button的坐标走
//pageControl
- (void)customButton:(NSInteger)btnCount {
NSInteger i = 0;
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:0];
_arrBtn = [[NSMutableArray alloc] initWithCapacity:0];
for (; i<btnCount; i++) {
UIButton *button= [UIButtonbuttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, i*15, 10, 10);
button.clipsToBounds = YES;
button.layer.cornerRadius = 5;
button.tag = 1001+i;
button.backgroundColor = [UIColor grayColor];
[_viewPage addSubview:button];
[arr addObject:button];
}
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,10, 10)];
label.backgroundColor = [UIColor redColor];
label.clipsToBounds = YES;
label.tag = 3000;
label.layer.cornerRadius = 5;
[_viewPage addSubview:label];
self.arrBtn = arr;
}
一般UIPageControl是配合UIScrollView显示的,但是既然UIPageControl是竖着显示;那么UIScrollView也是竖着滑动的,滑动Scroll的时候,PageControl跟着滑动
scroll代理方法
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
NSInteger tag = scroll.contentOffset.y/scroll.frame.size.height;
UILabel *label = (UILabel *)[_viewPage viewWithTag:3000];
label.frame = CGRectMake(0, tag*15, 10, 10);
}
- 竖着显示的“UIPageControl”
- winform的label控件竖着显示
- 把字体竖着显示
- 让Label竖着显示
- easyui 表头竖着显示
- iOS 字体竖着显示
- 在HTML页面上竖着显示内容的方法
- SQL 如何查询时竖着的数据横着显示
- asp.net 竖着显示数据
- poi excel 字体竖着显示
- 自定义竖着的SeekBar
- 竖着的Seekbar
- 竖着的UISlider
- verticalTablayout竖着的tablayout
- 竖着的Tablayout
- echarts 中类目名称转为竖着显示 显示不全的处理
- 如何设置tabcontrol控件的tabPage的text内容显示成竖着的字体
- tabcontrol控件的tabPage的text内容显示成竖着的字体
- 文章标题
- 2011 Asia Fuzhou Regional Contest
- [leetCode] Rotate Array
- C/C++ 数字转化为字符串函数
- MySQL优化必须调整的10项配置
- 竖着显示的“UIPageControl”
- Objective_C设计模式
- BroadcastReceiver开机启动
- linux的一些最常用命令
- Dense Trajectory
- hdu1018(大水题)
- 当你在浏览器地址栏输入一个URL后回车,将会发生的事情?
- 从输入 URL 到页面加载完的过程中都发生了什么事情?
- HttpClient使用详解