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 ...
随机推荐
- IIS Express 配置json minitype
IIS Express 配置json minitype 1.在命令窗口中cd到IIS Express安装目录,默认是“C:\Program Files\IIS Express”: 2.在IIS Exp ...
- 非[无]root权限 服务器 下安装perl以及perl模块
转载自http://www.zilhua.com 在本博客中,所有的软件安装都在服务器上,且无root权限.理论上适合所有的用户. 我的安装目录 cd /home/zilhua/software 1. ...
- hihocode 九十七周 中国剩余定理
题目1 : 数论六·模线性方程组 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho:今天我听到一个挺有意思的故事! 小Hi:什么故事啊? 小Ho:说秦末,刘邦的将军 ...
- PCH Warning: header stop cannot be in a macro or #if block.
在编写头文件时,遇到这么一个warning:PCH Warning: header stop cannot be in a macro or #if block. An intellisense PC ...
- shell :
示例一.(用作注释,占位)#!/bin/bash : this is single line comment : 'this is a multiline comment, second line e ...
- 编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。 但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”,输入“我ABC汉DEF”,6,应该输出为“我ABC”而不是“我ABC+汉的半个”。
一.需要分析 1.输入为一个字符串和字节数,输出为按字节截取的字符串--->按照字节[byte]截取操作字符串,先将String转换成byte类型 2.汉字不可以截半--->汉字截半的话对 ...
- ORACLE 多表查询优化收集整理
搞WEB的离不开数据库,在一个层面上,对数据库的熟练程度决定了很多的事情. 本文就大家都纠结的ORACLE多表查询的性能问题给出一系列个优化方法,那这些都是项目中长期用到的,所以很熟,很熟,已经成为习 ...
- [设计模式]工厂模式factory
参考:http://wxg6203.iteye.com/blog/740229 简单工厂模式(simple factory)是类的创建模式,又叫静态工厂方法(static factory method ...
- Codeforces 820B - Mister B and Angle in Polygon
820B - Mister B and Angle in Polygon 思路: 由于正多边形以某个顶点分成的三角形后以这个点为顶点的角都相等,所以可以确定两个点为相邻点,只要再找一个点就够了. 证明 ...
- BeanShell使用json.jar包处理Json数据
环境准备 ①Jmeter版本 ,JDK ②前置条件:将json.jar包置于..\lib\下, 如果还是报错,可以将该jar包添加到测试计划的Library中:否则会报:Typed variable ...