简体   繁体   中英

Strange keyboard behavior occurring in iOS11 during transition

In a view controller, I have a view, paddingView . I am transitioning to another view, categoryView , when an event occurs (button is pressed), and this transition is of type UIViewAnimationOptions.transitionFlipFromRight . Previously, this worked wonderfully. However, in the iOS11 (im using 11.1), the keyboard seems to jump when this animation occurs.

//viewDidLoad
titleTextField.becomeFirstResponder()

fileprivate func flipViewToRight() {
    //transitionTextField is an off screen textfield, used to keep keyboard up during transition
    transitionTextField.becomeFirstResponder()

    UIView.transition(from: paddingView, to: self.categoryView!, duration: 0.8, options: UIViewAnimationOptions.transitionFlipFromRight, completion: { (finished: Bool) -> () in            
        self.categoryView?.searchTextField.becomeFirstResponder()
    })
}

And this is the behavior that occurs: https://youtu.be/31xNqBMi-BI

Is this a bug with iOS11? It only seems to occur when this transition is occurring.

**Also: The keyboard is always open on this view controller, there is always a textfield that is a first responder, before titleTextField , during transitionTextField , and after self.categoryView?.searchTextfield the flip

I forgot to resign the active textfield before activating another one, this seemed to fix the issue:

taskTitleTextView.resignFirstResponder()
transitionTextField.becomeFirstResponder()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM