UI基础之 -------- 轮播图 UIScrollew UIPageControll NSTime
来源:互联网 发布:新东方网课怎么样 知乎 编辑:程序博客网 时间:2024/06/04 23:37
1.UIScrollew
1》常见属性
UIScrollew不能滚动时查看这几个属性设置了没: contentSize ;scrollEnabled;
contentSize : UIScrollew能滚动到实际尺寸。 (必须设置)
contentOffset :偏移量 (CGPoint类型) (可以获取 或者 手动进行设置)
[ScrollView setContentOffset:CGPointMake(0, 0) animated:YES]; 使用set方法可以有donghua
pagingEnabled = yes : 分页效果,根据UIScrollew的宽度进行分页
scrollEnabled : 是否允许滚动
contentInset : 内边距
bounces : 是否需要弹簧效果
showsHorizontalScrollIndicator = no :水平滚动条隐藏
showsVerticalScrollIndicator = no : 垂直滚动条隐藏
2.监听 UIScrollew 的滚动,使用代理 可以时时监控滚动到什么位置
代理方法:
1》 - (void)scrollViewDidScroll:(UIScrollView *)scrollView; //用户在滚动的时候
2》- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; //用户拖拽完毕以后
3》 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; // 用户即将脱拽的时候
minimumZoomScale :最小的缩放多小
maximumZoomScale : 最大放多大
4》- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView; // 缩放
2.UIPageControll
常用属性
numberOfPages :总页数
currentPage : 指定默认第几页
pageIndicatorTintColor : 颜色
currentPageIndicatorTintColor :当前指示器颜色
//轮播图:在UIScrollew 的滚动代理方法中 计算试图的偏移量:加上半页的宽度,用偏移量/页的宽度,得到当前指示器位置。
3.NSTimer
1>创建
创建好后自动启动
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(nstimer) userInfo:nil repeats:YES];
// 在计时器的方法中,拿到当前页码数,判断是不是最后一页,如果是等于第一页,页吗++,偏移量等于宽度 * 页吗。
//注意:在即将实施拖拽时,停止计时器 [timer invalidate] ,将计时器指向 nil , 在拖拽完毕时,重新开启一个计时器。
//需要提高时间控制器的优先级 , 对拖拽完毕重新创建的nstimer 也需要提升优先级
NSRunLoop *loop = [NSRunLoop currentRunLoop];
[loop addTimer:timer forMode:NSRunLoopCommonModes];
- UI基础之 -------- 轮播图 UIScrollew UIPageControll NSTime
- IOS基础UI之(七)综合小案例-猜图
- UI基础之 --------- UITableView
- IOS每天15个注意点系列之UI-控件基础
- IOS基础UI之(六)综合小案例-应用管理
- [-UI设计-] UI设计文档
- UI大时代-UI设计概述
- MFC学习之路之UI --(7)商业化UI
- UI Automation-InvokePattern
- UI Automation-ValuePattern
- UI Automation-TogglePattern
- UI Automation-WindowPattern
- UI Automation-GridPattern
- UI Automation-TablePattern
- UI Automation-RangeValuePattern
- UI Automation-TransformPattern
- UI-Json解析
- UI控件 - UIImageView
- 简单的maven项目
- PS学习笔记之色彩模式
- Android代码优化小技巧总结
- 再谈iOS 7的手势滑动返回功能
- 软件测试分类
- UI基础之 -------- 轮播图 UIScrollew UIPageControll NSTime
- find操作总结
- 字符串的左右移动
- 1002写出这个数
- 在Windows上安装NumPy、Matplotlib、SciPy和IPython
- Dom4解析xml
- 解决Httpclient.exec(method)不执行或抛出异常的方法
- 1003我要通过
- 软件缺陷