Broken animation pushing with UINavigationController if keyboard is visible

We noticed that with Xcode 14 and iOS16+, when the app navigates to a view controller that has a UITextField getting focus in viewWillAppear() via calling becomeFirstResponder(), the transition starts on the right, then returns a bit back, then resumes, and the keyboard is moving at the same time, resulting in a noticeable visually jerking animation.

This does not happen with Xcode 13, or with Xcode 14 when running under iOS15.

Is this a known bug? Has someone else seen this behavior?

Any ideas for a workaround? We tried disabling animations, but this does not work well. We can use viewDidAppear to display the keyboard after push animation is completed, but it takes a bit more time and not so nice as pushing the next view controller with already displayed keyboard.

Post not yet marked as solved Up vote post of serge_o Down vote post of serge_o
2.0k views

Replies

same here

I have the same problem

I have same prob too

I have the same problem too

same problem..

Same here - (the back animation has the same issue)

In your viewWillAppear:

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
        self.textView.becomeFirstResponder()
    }

A solution was to call the becomeFirstResponder() method in the viewDidAppear method

public override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.textField.becomeFirstResponder()
    }
  • It is not a solution, it is workaround. It adds a huge delay for keyboard presentation. Issue is still presented

Add a Comment