Jack Chen
Jack Chen

Reputation: 518

Xcode 14: custom inputAccessoryView appears prematurely, causing broken push animation

After upgrading to xcode 14, override of the inputAccessoryView of a UIViewController causes animation issues during push / pop UINavigationController transitions. (on xcode 13, no issues)

    override var inputAccessoryView: UIView? {
        return myCustomInputBar
    }

    override var canBecomeFirstResponder: Bool{
        return true
    }

The two main issues are:

  1. The inputAccessoryView flashes / appears above the current view you're transitioning away from. (inputAccessoryView should display only within the confines of it's UIViewController)

  2. The push / pop transition animation is not smooth. The new screen moves forward and then backwards briefly before continuing forward again.

https://developer.apple.com/forums/thread/721301 (this issue mentions the same thing)

Here's screenshots of the inputAccessoryView appearing prematurely:

enter image description here enter image description here

Here's Videos of the issue: Broken push animation / input bar flash

Broken pop animation / input bar flash

Current workaround: Only show inputBarAccessoryView in viewDidAppear, which fixes the animation problems during the navigationController transition but this causes a significant delay.

Has anyone else run into this issue? Any help would be very much appreciated.

Upvotes: 1

Views: 168

Answers (1)

adseeAnn
adseeAnn

Reputation: 37

I'm having this exact issue. What I've decided to do is to avoid overriding inputAccessoryView, instead I've added my accessory view directly to a ViewController and constrained it to keyboardLayoutGuide.

I've been told that avoiding inputAccessoryView may not be an option because it's responsible for other things and provides better layout in cases like detached keyboard in iPadOS, external keyboard, etc. But it might work for you, it certainly worked for my app and helped me resolve other visual bugs with accessory view animations.

Upvotes: 0

Related Questions