I'd like to add a right bar button with the system's info icon to a navigation bar. But I see that UIBarButtonSystemItem
does not provide such type of button. On the other hand, so I tried with a UIButton
of type UIButtonType.infoLight
, but I am not allowed to assign it to navigationItem.rightBarButtonItems
.
Is there any way to do this?
Swift 5.0
Add the infoButton image into your assets and set as barButton by providing the name .
In Swift
this can be achieved using
UIButton
object of type.infoLight
alternatively:
by adding
infoImage
to yourAsset catalog
and createbarButtonItem
using below codeYou can initialize a
UIBarButtonItem
with a custom view:I have found an easier way to add info icon to a navigation bar using Interface Builder.