我使用单个按钮显示登录字段。如果我们点击一次,登录视图移动左侧,将显示注册视图,然后,如果我们再次点击,注册视图将向右移动,将显示登录视图。我的编码如下。但是动画不起作用。请指导我。
var bottom_click : Bool = true
@IBAction func not_member_button(sender: UIButton) {
if(bottom_click == false) {
UIView.animateWithDuration(0.7, delay: 0.0, options: .CurveEaseOut, animations: {
self.login_view.frame = CGRectMake(16, 150, 288, 187)
self.crea_acc_view.frame = CGRectMake(370, 150, 288, 245)
}, completion: { finished in
//println("Basket doors opened!")
})
sender.titleLabel?.text = "Not a member? Sign Up" //Its not working. If we delete this, animation is working
bottom_click = true
}
else {
UIView.animateWithDuration(0.7, delay: 0.0, options: .CurveEaseOut, animations: {
self.login_view.frame = CGRectMake(-500, 150, 288, 187)
self.crea_acc_view.frame = CGRectMake(16, 150, 288, 245)
}, completion: { finished in
//println("Basket doors opened!")
})
sender.titleLabel?.text = "Already member? Login" // Its is not working. If we delete this, animation is working
bottom_click = false
}
}