[英]Simple animation working on iOS 8 but not iOS 7
我下面有一個簡單的動畫代碼。 應該將UILabel從其當前位置下方的250點移動到其當前位置。 它可以在iOS 8.1的模擬器上正常運行,但是當我嘗試在模擬器的iOS 7.1上對其進行測試時,動畫不是從-250開始,而是從當前位置開始並向上移動。 有什么想法嗎?
UIView.animateWithDuration(0.4, delay: 0, options: .CurveEaseOut, animations:{
var animateLabel = self.signLabel.frame
animateLabel.origin.y -= 250
self.signLabel.frame = animateLabel
}, completion: {finsihed in
self.doAfterAnimation()
})
看一下這個,
//To go from Y = -250 to Y = 250
var animateLabel = UILabel(frame: CGRectMake(0, -250, 100, 100))
animateLabel.text = "MyLabel"
self.view.addSubview(animateLabel)
UIView.animateWithDuration(5.0, animations: {
animateLabel.frame.origin.y = 250
})
//To go from Y = 250 to Y = -250
var animateLabel = UILabel(frame: CGRectMake(0, 250, 100, 100))
animateLabel.text = "MyLabel"
self.view.addSubview(animateLabel)
UIView.animateWithDuration(5.0, animations: {
animateLabel.frame.origin.y = -250
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.