How to Animate UILabel Properties

UILabel properties cannot be easy animated due to some various reasons, so code like this will have no effect on it:

1
2
3
4
5
6
7
self.someLabel.textColor = [UIColor blueColor];

[UIView animateWithDuration:0.3
animation:^{ self.someLabel.textColor = [UIColor redColor];
}];

But there is a simple solution. Instead of animating property we will perform transition on object itself.

Using transitionWithView should solve our problem:

1
2
3
4
5
6
7
8
9
10
self.someLabel.textColor = [UIColor blueColor];

[UIView transitionWithView:self.someLabel
duration:0.3
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{ self.someLabel.textColor = [UIColor redColor]; } completion:nil];

This creates nice fade in/out animation which is exactly what we want.

How to Animate UILabel textColor Properties的更多相关文章

  1. JavaScript - 基于CSS3动画的实现

    在痛苦的IE8时代,所有的动画都只能基于自己计算相关动画属性,开定时器setTimeout/setInterval轮询动画任务. 而肩负重任的HTML5,早已注意到了日益增强的动画,随着HTML5的降 ...

  2. jsPlumb 学习笔记

    介绍 使用svg完成画图,四个概念: anchor: endpoint在的位置,可通过name访问 endpoint:connection的一端节点,通过addPoint makeSource, co ...

  3. jQuery ui背景色动态渐变导航菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. jquery-1.11.1.js

       每次想要使用这个js时,总是要到官网上下载,太麻烦,现在把它收录了 jquery-1.11.1.js /*! * jQuery JavaScript Library v1.11.1 * http ...

  5. ASP.NET之Jquery入门级别

    1.Jquery的简单介绍 1)Jquery由美国人John Resig创建.是继prototype之后又一个优秀的JavaScript框架. 2)JQuery能做什么?JQuery能做的普通的Dom ...

  6. jQuery JavaScript Library v3.2.1

    /*! * jQuery JavaScript Library v3.2.1 * https://jquery.com/ * * Includes Sizzle.js * https://sizzle ...

  7. View Programming Guide for iOS ---- iOS 视图编程指南(五)---Animations

      Animations Animations provide fluid visual transitions between different states of your user inter ...

  8. jquery2.0.3 全部源码

    /*! * Includes Sizzle.js 选择器,独立的库 * http://sizzlejs.com/ */ (function( window, undefined ) { //" ...

  9. jquery源码09 (6058 , 6620) css() : 样式的操作

    var curCSS, iframe, // swappable if display is none or starts with table except "table", & ...

随机推荐

  1. 【转】package control安装成功,但是ctrl+shiif+p调不出来面板,preference里面也没有Package Control

    原文:http://blog.csdn.net/fangfanggaogao/article/details/54405866 sublime text2 用了很长很长时间了,和package con ...

  2. python -- 函数进阶

    一.函数参数-动态传参       1.形参:         *   在形参位置, 表示此参数为不定参数,接受的是位置参数            并且接收到的位置参数的动态传参都是元组 def fu ...

  3. '假定以下程序经编译和连接后生成可执行文件PROG.EXE,如果在此可执行文件所在目录的DOS提示符下键入:PROG ABCDEFGH IJKL<回车>,则输出结果为( ). void main( int argc, char *argv[]) { while(--argc>0) cout<<argv[argc]; cout<<"\n"; }

    main(int argc,char *argv[])函数的两个形参,第一个int argc,是记录你输入在命令行(你题目中说的操作就是命令行输入)上的字符串个数:第二个*argv[]是个指针数组,存 ...

  4. 基于Live555实现RtspServer及高清高分辨率和高码率视频传输优化

    基于Live555实现RtspServer及高清高码率视频传输优化 最近做了一些pc和嵌入式平台的RTSP服务器项目,大多数的要求是简单但是功能全面,并且性能还要强劲.综合考虑后,基本都是在基于liv ...

  5. linux常用命令 cut字符截取命令

    cut 字符截取 cut [选项] 文件名 选项 -f 列号: 提取第几列 -d 分割符:按照指定的分隔符分割列 默认使用制表符("tab")进行分割 ssgao:Download ...

  6. float和position谁好?

    float从字面上的意思就是浮动,float能让元素从文档流中抽出,它并不占文档流的空间,典型的就是图文混排中文字环绕图片的效果了.不过需要注意的是清除浮动是我们可能需要注意的地方.而position ...

  7. 运维架构之httpd

    Web Service 传输层:提供进程地址 Port number tcp:传输控制协议,面向连接,通信前需建立虚拟链路,结束后拆除:0-65535 udp:用户数据报协议,无连接:0-65535 ...

  8. 初学者--oracle安装完后出现的一些问题

    对于初学者安装数据库后,立马回运行数据库,看是否安装成功,但oracle安装完成,其中有些都是默认状态,所以需要手动修改和添加.例如这个问题 1.pl/sql developer was not te ...

  9. Delphi 对ini文件的操作

    界面如图: 代码如下: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Vari ...

  10. cscope和ctags自动更新

    1.写一个shell脚本,定时更新数据库文件,命名为auto_load_cscope.sh,在/usr/local/bin里设置软链接为autocs #!/bin/bash cd $1 while : ...