我试图将UILabel和UIButton移动到我的应用程序的屏幕上,但是,当我使用动画执行此操作时,它不起作用,并且当动画应该发生时,组件不要移动到屏幕上。这是动画的代码:
"SELECT *
FROM Rule
JOIN RuleList
ON Rule.ruleID = RuleList.ruleID
WHERE Rule.accountID = '$login_user' and RuleList.accountID ='$login_user';
非常感谢任何有关此问题的帮助!
答案 0 :(得分:1)
你应该试试这个。使用layoutIfNeeded()将重新定位所有内容。
UIView.animateWithDuration(2) { () -> Void in
self.label.center = CGPointMake(self.view.center.x, self.label.center.y)
self.again.center = CGPointMake(self.view.center.x, self.again.center.y)
self.view.layoutIfNeeded()
}
答案 1 :(得分:0)
试试这个!
UIView.animateWithDuration(1.0,
delay: 2.0,
options: .CurveEaseInOut ,
animations: {
self.label.center = CGPointMake(self.view.center.x, self.label.center.y)
self.again.center = CGPointMake(self.view.center.x, self.again.center.y) },
completion: { finished in
println("Bug moved left!")
self.faceBugRight()
})
}