【发布时间】:2016-01-10 19:36:57
【问题描述】:
我是 swift 新手,这是我有史以来的第一个问题.... 我想缩小一个持续时间为 2 秒的球,然后将其扩大 5 秒。 我的问题是第二个持续时间被忽略(球缩小 2 秒并增长 2 秒)。 我希望有人可以帮助我。
这是我的尝试:
let ball = UIView()
ball.frame = CGRectMake(50, 50, 50, 50)
ball.backgroundColor = UIColor.blueColor()
ball.layer.cornerRadius=25
relaxContainer.addSubview(ball)
UIView.animateWithDuration(2.0, delay:0, options: [.Repeat, .Autoreverse], animations: {
ball.frame = CGRectMake(50, 50, 20, 20)
}, completion: { finished in
UIView.animateWithDuration(5.0, animations: {
ball.frame = CGRectMake(50, 50, 50, 50)
})
})
【问题讨论】:
标签: ios swift animation animatewithduration