Ben Guild Ben Guild - 5 months ago 30
iOS Question

How to make message input toolbar float at the bottom of UINavigationController, like Messages app?

I've searched around and I haven't found a good solution for this.

While

UINavigationController
has a
UIToolbar
hidden that is built-in, there are a few different issues with putting a
UITextView
in it for multi-line text input... which resizes accurately to a maximum height after a few different lines are added. It's not a natural fit for
UIToolbar
, even when putting it in as a custom view item. There are numerous issues.

If one wants to put a message input with a "send" button that floats at the bottom of a
UINavigationController
's child
UIViewController
(which perhaps has a
UIScrollView
for messages inside of it) ... How would one go about doing that? Basically, the goal is to clone the iMessage/Messages app's bottom send bar.

screenshot of <code>Messages</code> app input bar

Some of the solutions have talked about making it the
inputAccessoryView
or something, but that disappears when the keyboard is hidden. Having two of those (one under the other) seems terrible.

With so many messaging apps on the App Store, surely there must be a good solution?

Answer

Using the inputAccessoryView for the UIViewController as in the example of this Cocoa Pod is the only thing I've found that works: https://github.com/datwelk/RDRGrowingTextView

Comments