UIView.animateWithDuration 没有动画过渡效果直接跳到最后
当我在viewDidLoad()方法内添加以下代码的时候发现程序运行时不会有动画过度效果,而是直接跳到了最后。
let x = (self.view.bounds.size.width - 268) / 2
scanImage.frame = CGRectMake(x, 106, 268, 2)
scanImage.contentMode = UIViewContentMode.ScaleAspectFill
self.view.addSubview(scanImage) UIView.animateWithDuration(2, delay: 0, options: UIViewAnimationOptions.Repeat, animations: { () -> Void in
self.scanImage.frame = CGRectMake(x,372, 268, 2)
}, completion: nil)
通过度娘后有网友说要把该代码块放到viewDidAppear(animated: Bool)方法内,试以一下果然有动画效果了。这到底是为什么啊?who can tell me why?
UIView.animateWithDuration 没有动画过渡效果直接跳到最后的更多相关文章
- swift uiview弹出动画
UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.3, initialSpringVelocity: 0.0, ...
- [UIView beginAnimations:context:]与[UIView animateWithDuration:animations:]值得注意的一个区别
原文链接:http://longtimenoc.com/archives/uiview-beginanimationscontext%E4%B8%8Euiview-animatewithduratio ...
- iOS UIView简单缩放动画
@interface ViewController () { UIView *animationView; UIButton *button; CGPoint animationPoint; } @e ...
- xcode UIView常用方法属性动画
常见属性: @property(nonatomic,readonly) UIView *superview; 获得自己的父控件对象 @property(nonatomic,readonly,copy) ...
- UIView animateWithDuration 使用详解
在ios4.0及以后鼓励使用animateWithDuration方法来实现动画效果.当然,以往的begin/commit的方法依然使用,下面详细解释一下animateWithDuration的使用方 ...
- iOS开发——动画编程Swift篇&(二)UIView转场动画
UIView转场动画 // MARK: - UIView动画-过度动画 var redView:UIView? var blueView:UIView? // enum UIViewAnimation ...
- UIView转场动画属性设置
常规动画属性设置(可以同时选择多个进行设置) UIViewAnimationOptionLayoutSubviews:动画过程中保证子视图跟随运动. UIViewAnimationOptionAllo ...
- UIView 弹出动画
// 展开动画 - (void)beginAnimations { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView begi ...
- CSS3动画--过渡效果
CSS3动画--过渡效果 transition 设置四个过渡属性 transition-property 过渡的名称 tr ...
随机推荐
- python删除所有自定义变量方法--转载
http://blog.sina.com.cn/s/blog_b2f983a50102yexs.html 当我们在pythonwin中创建多个变量后,通过dir()函数,可以看到所有已创建变量,这 ...
- Ubuntu 14.04 vi 退格键不能删除字符
执行命令 sudo apt-get install vim
- STL_iterator返回值
1. iterator的类型 有 单向的/双向的/可以随意移动的... 2. 一些 容器/算法 的返回值 是 iterator类型的,如何确定 返回的 iterator是什么类型的? 3.
- 《Blue Flke》团队项目需求改进与系统设计
Github地址:https://github.com/13993013291/ruanjianguigexuqiu/tree/master 一.团队项目需求分析改进 1.<通讯录管理系统需求说 ...
- java开源类库pinyin4j的使用
最近CMS系统为了增加查询的匹配率,需要增加拼音检索字段,在网上找到了pinyin4j的java开源类库,提供中文转汉语拼音(并且支持多音字), 呵呵,看了看他的demo,决定就用它了,因为我在实际使 ...
- ubuntu配置zsh和oh-my-zsh
1安装zsh sudo apt-get install -y zsh chsh -s /bin/zsh 2安装oh-my-zsh $ sh -c "$(curl -fsSL https:// ...
- Codeforces 260D - Black and White Tree
260D - Black and White Tree 思路:把两种颜色先按值sort一下,最小值肯定是叶子,然后把这个叶子和另外一中颜色的一个最小值的节点连接起来,再把这个节点变成叶子,把值减掉就可 ...
- Unity搭建简单的图片服务器
具体要实现的目标是:将图片手动拷贝到服务器,然后在Unity中点击按钮将服务器中的图片加载到Unity中. 首先简答解释下 WAMP(Windows + Apache + Mysql + PHP),一 ...
- 20170706wdVBA保存图片到本地API
Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Pri ...
- 12月21日 简单理解Active Recore Callback, destroy_all和delete_all的区别。豆知识(alias),语言学习法(4核心)
destroy_all and delete_all Destroy the records by instantiating each record and calling its #destroy ...