图片轮播器 部分自用
来源:互联网 发布:淘宝点收藏没反应 编辑:程序博客网 时间:2024/06/05 17:46
图片轮播器中用到了UIScrollView 和 他的代理
图片的缩放
1.使用代理方法
viewForZoomingInScrollView:(UIScrollView *)scrollView 告诉scrollView要对哪个view进行缩放
2.必须设置最大的放大倍数,最小的缩小倍数
//最大放大到3倍
_scrollView.maximumZoomScale = 3;
//最小 缩小到 0.2倍
_scrollView.minimumZoomScale = 0.2;
二.图片轮播器
//分页效果
scrollView.pagingEnabled = YES;
UIPageControle
//共有多少个点
numberOfPages
//当前点
//取值范围 在 0 -- (numberOfPages - 1)
currentPage
//设置当前点的颜色
// Indicator :指示器
currentPageIndicatorTintColor
//设置非当前点的颜色
pageIndicatorTintColor
计时器:
//会自动开始执行
/**
TimeInterval : 时间间隔
target : 一般是控制器 self
selector : 要执行的方法
userInfo : 自定义的参数
repeats : 是否重复
每隔一秒钟的时间,去调用 target(控制器) didClickButton: 参数为nil,
*/
_timer = [NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(didClickButton:)
userInfo:nil
repeats:YES];
fire : 立即执行,不会等待 timerInterval之后再去执行
invalidate : 计时器 无效,一旦无效化之后,就必须重新实例化timer
如果使用这种方式去实例化timer
_timer = [NSTimer timerWithTimeInterval:1
target:self
selector:@selector(didClickButton:)
userInfo:nil
repeats:YES];
必须得手动的把timer放置到runLoop当中
NSRunLoop *mainLoop = [NSRunLoop currentRunLoop];
//把timer添加到runLoop中
/**
NSDefaultRunLoopMode : 优先级更低
NSRunLoopCommonModes
*/
//提升 timer的优先级
//分页效果
scrollView.pagingEnabled = YES;
UIPageControle
//共有多少个点
numberOfPages
//当前点
//取值范围 在 0 -- (numberOfPages - 1)
currentPage
//设置当前点的颜色
// Indicator :指示器
currentPageIndicatorTintColor
//设置非当前点的颜色
pageIndicatorTintColor
计时器:
//会自动开始执行
/**
TimeInterval : 时间间隔
target : 一般是控制器 self
selector : 要执行的方法
userInfo : 自定义的参数
repeats : 是否重复
每隔一秒钟的时间,去调用 target(控制器) didClickButton: 参数为nil,
*/
_timer = [NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(didClickButton:)
userInfo:nil
repeats:YES];
fire : 立即执行,不会等待 timerInterval之后再去执行
invalidate : 计时器 无效,一旦无效化之后,就必须重新实例化timer
如果使用这种方式去实例化timer
_timer = [NSTimer timerWithTimeInterval:1
target:self
selector:@selector(didClickButton:)
userInfo:nil
repeats:YES];
必须得手动的把timer放置到runLoop当中
NSRunLoop *mainLoop = [NSRunLoop currentRunLoop];
//把timer添加到runLoop中
/**
NSDefaultRunLoopMode : 优先级更低
NSRunLoopCommonModes
*/
//提升 timer的优先级
[mainLoop addTimer:_timer forMode:NSRunLoopCommonModes];
0 0
- 图片轮播器 部分自用
- 自用图片
- 自用部分正则表达式
- 自用Android图片处理
- 自用
- 自用
- 自用
- 自用
- 自用
- 自用
- daimajia的图片轮播开源项目AndroidImageSlider(自用,记录用)
- 截图屏幕部分图片
- 截取 视图 部分 图片
- 截取图片某一部分
- UIImage图片部分拉伸
- 截取图片的部分
- MFC 图片部分透明
- redhat 截取部分图片
- 《Effective STL》学习笔记(第三部分)
- Mac MySQL修改密码
- 【VS开发】COM组件技术概述
- 设置stm32系统各部分时钟
- java多线程深入理解
- 图片轮播器 部分自用
- 新人小窝
- android 基础知识
- 《Effective STL》学习笔记(第四部分)
- 剑指Offer--005-从尾到头打印链表
- lintcode: Maximum Subarray
- poj天梯300题
- Java 浅谈输入输出流
- 计算字符串最后一个单词的长度,单词以空格隔开