利用POPAnimatableProperty属性来实现动画倒计时
POPAnimatableProperty *prop = [POPAnimatableProperty propertyWithName:@"countdown" initializer:^(POPMutableAnimatableProperty *prop) { prop.writeBlock = ^(id obj,const CGFloat values[])
{ NSLog(@"%d",(int)values[]);
NSString *timestring = [NSString stringWithFormat:@"%02d:%02d:%02d",(int)values[]/,(int)values[]%,(int)(values[]*)%];
_lblTest.attributedText = [self formatterTime:timestring];
};
}];
POPBasicAnimation *anBasic = [POPBasicAnimation linearAnimation]; //秒表当然必须是线性的时间函数
anBasic.property = prop; //自定义属性
anBasic.fromValue = @(*); //从0开始
anBasic.toValue = @(); //180秒
anBasic.duration = *; //持续3分钟
anBasic.beginTime = CACurrentMediaTime(); //延迟1秒开始
[_lblTest pop_addAnimation:anBasic forKey:@"countdown"]; }
- (NSMutableAttributedString *)formatterTime:(NSString *)currentString
{ NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc]initWithString:currentString];
for (NSInteger i = ; i<; i++)
{
[attribute addAttributes:@{
NSBackgroundColorAttributeName:[UIColor redColor],
NSForegroundColorAttributeName:[UIColor whiteColor], }
range:NSMakeRange(*i, )];
}
return attribute;
}
@end
利用POPAnimatableProperty属性来实现动画倒计时的更多相关文章
- winform中ComboBox利用AutoComplete属性实现模糊查询(有缺陷)
上一篇文章是用ComboBox里面的原生事件实现模糊查询,操作比较灵活一些,但是收到评论说,利用AutoComplete属性就可以实现模糊查询,但是据本人所了解,AutoComplete虽然能够方便的 ...
- Flex利用titleIcon属性给Panel容器标题部添加一个ICON图标
Flex利用titleIcon属性,给Panel容器标题部添加一个ICON图标. 让我们先来看一下Demo(可以右键View Source或点击这里察看源代码): 下面是完整代码(或点击这里察看): ...
- 利用column-width属性设置多栏布局
css样式设置为: div{ background:blanchedalmond; margin:0 auto; width:1230px; -moz-column-width:400px; -web ...
- bootstrap学习之利用CSS属性pointer-events禁用表单控件
参考链接: CSS3 pointer-events:none应用举例及扩展 首先pointer-events在除去SVG中的应用只有两个值:AUTO | NONE pointer-events:non ...
- 利用referer属性,记录百度搜索跳转参数
从百度搜索结果跳转到指定链接前,百度会发送一些参数,可以利用referer属性,在本站访问时记录百度跳转来之前的一些参数. 利用百度跳转前参数,进行一些相关的seo优化. 目前所用到的一些参数说明如下 ...
- [Flex] 组件Tree系列 —— 利用firstVisibleItem属性,设置或取得第一个显示节点
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述: 利用firstVisibleIt ...
- JQuery:介绍、安装、选择器、属性操作、动画
目录 jQuery 详细内容 1.JQuery介绍 2.JQuery的下载安装 3.JQuery的使用 4.jQuery的选择器 5.JQuery的属性操作 6.动画 6.自定义动画 jQuery 详 ...
- [WPF自定义控件库]了解WPF的布局过程,并利用Measure为Expander添加动画
1. 前言 这篇文章介绍WPF UI元素的两步布局过程,并且通过Resizer控件介绍只使用Measure可以实现些什么内容. 我不建议初学者做太多动画的工作,但合适的动画可以引导用户视线,提升用户体 ...
- 利用Android属性动画实现Banner的原理与实践
事实上在Android刚推出属性动画的时候.就想利用它来设计一个Banner控件,一直没什么时间尝试. 在当时看我们应用中的Banner,使用计时器来控制自己主动播放,设置一个非常大的数,利用余数原理 ...
随机推荐
- uva 1401
Neal is very curious about combinatorial problems, and now here comes a problem about words. Knowing ...
- JS练习:定时弹出广告
代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title ...
- Cent os常见操作命令
1.查看防火墙状态:firewall-cmd –-state 2.关闭防火墙:systemctl stop firewalld.service 3.禁止防火墙开机启动:systemctl disabl ...
- Python2 下Ubuntu linux Mac 安装 PyV8
在pip install PyV8(注意区分大小写)时,出现了如下报错 command 'x86_64-linux-gnu-gcc' failed with exit status 1 解决方案: 百 ...
- 【Codeforces Global Round 1 C】Meaningless Operations
[链接] 我是链接,点我呀:) [题意] 给你一个a 让你从1..a-1的范围中选择一个b 使得gcd(a^b,a&b)的值最大 [题解] 显然如果a的二进制中有0的话. 那么我们就让选择的b ...
- ansible common modules
##Some common modules[cloud modules] [clustering modules] [command modules]command - executes a comm ...
- hdu 4550
c: #include<stdio.h> #include<string.h> #define N 300 int f[N]; char s[N]; int main() { ...
- [cf 599C] Day at the Beach
题意:有n个数,将其分组使整个数列排序后每组中的数仍在该组中,求最多的分组数. 代码很易懂 #include <iostream> #include <algorithm> # ...
- linux 下ip命令对比ifconfig命令
原文:https://linux.cn/article-3144-1.html ------------------------------------------------------------ ...
- linux 获取经过N层Nginx转发的访问来源真实IP
linux 获取经过N层Nginx转发的访问来源真实IP 学习:http://blog.csdn.net/zhenzhendeblog/article/details/49702575 学习:http ...