Set UIBarButtonItem's background color working with Storyboard swift

205 views Asked by At

I know that this has been asked really often, but I couldn't find anything about doing this with an IBOutlet.

I have already found some code how to set the background color of an UIBarButtonItem when you create it with code. But I have implemented many connections from the UIBarButtonItem I created in the Storyboard.

Is it possible to set the background color and the corner radius of a Storyboard-UIBarButtonItem? And if it is, please write me how.

Thanks and sorry for my English.

1

There are 1 answers

0
MBT On BEST ANSWER

First, drag and drop a UIButton to UINavigationBar. Then from Document Outline select the UIButton which is a child of UIBarButtonItem.

enter image description here

Now go to Identity Inspector from the right panel. Here in User Defined Runtime Attributes section you can set backgroundColor, cornerRadius etc. of UIButton.

enter image description here

But the modification does not reflect in Storyboard. Run your project and you can see the changes.

enter image description here