1
行,所以我有出現,並用鍵盤隱藏(當鍵盤出現它也出現當我關閉鍵盤它也與鍵盤消失)正在進行的動畫引起延遲,同時移動到另一個視圖控制器
因此,當我」 A button
中號按此button
這將打開另一個瀏覽器的過渡不會立即開始有延遲的少量(這是不好的)
我的按鈕的動畫:
func keyboardWillShow(notification:NSNotification) {
let userInfo:NSDictionary = notification.userInfo!
let duration: Double = (notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as! Double)
let keyboardFrame:NSValue = userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey) as! NSValue
let keyboardRectangle = keyboardFrame.CGRectValue()
self.nextButtonConstraint.constant = keyboardRectangle.height
UIView.animateWithDuration(duration) {
self.nextButton.layoutIfNeeded()
}
}
func keyboardWillHide(notification:NSNotification) {
let duration: Double = (notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as! Double)
self.nextButtonConstraint.constant = -50
UIView.animateWithDuration(duration) {
self.nextButton.layoutIfNeeded()
}
}
我累了禁用的動畫,同時按鈕被按下,但它並沒有奏效:根據本similar question的
@IBAction func nextButtonAction(sender: AnyObject) {
UIView.setAnimationsEnabled(false)
performSegueWithIdentifier("nextToPasswordSegue", sender: self)
UIView.setAnimationsEnabled(true)
}
答案:
顯然有一個動畫在同一時間,這是怎麼回事造成問題。
任何線索我該如何解決這個問題?