iPhone X how to handle View Controller inputAccessoryView?

前端 未结 15 2649
长情又很酷
长情又很酷 2020-11-30 00:43

I have a messaging app that has the typical UI design of a text field at the bottom of a full screen table view. I am setting that text field to be the view controller\'s

15条回答
  •  攒了一身酷
    2020-11-30 01:21

    Solution that worked for me without workarounds:

    I'm using UIInputViewController for providing input accessory view by overriding inputAccessoryViewController property instead of inputAccessoryView in the "main" view controller.

    UIInputViewController's inputView is set to my custom input view (subclass of UIInputView).

    What actually did the trick for me is setting allowsSelfSizing property of my UIInputView to true. The constraints inside input view use safe area and are set up in a way that defines total view's height (similar to autoresizing table view cells).

提交回复
热议问题