I'm building an instant messenger app in iOS. In particular I'm implementing the UI for a conversation in the most typical way, that is placing an input bar at the bottom of the view (UICollectionView
to be clear) that scrolls above the keyboard.
Now, I'm wondering if I should implement this view as a UIToolbar
with UIBarButtonItem
s instead of a custom UIView
with UIButton
s. What are the advantages of a UIToolbar
?
I don't think there is much difference other than convenience. With a UIToolbar you get the following:
UIBarButton items are arguably simpler to add to a tool bar and the layout is automatic, whereas it is a bit more complicated adding buttons to a view.
You can set hidesBottomBarWhenPushed
on the view controllers to
hide the bar when a view controller is pushed to the nav stack.
Looks more familiar to other apps, including Apple's own apps.
If you use a UIView with buttons you have more flexibility in the appearance but you have to do a bit more work, but other than that I can't really see much difference.
UIToolbar will provide automatic placing of your buttons, saving you from pain of placing those buttons. It was designed specifically for this reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With