Creating an info button on the toolbar in the interface builder

I know how to create a soft button programmatically with UIButton:buttonWithType:

and UIBarButtonItem:initWithCustomView:

and supply an UIButton:buttonWithType

argument UIButtonTypeInfoLight

.

What I would like to do is drag the system button to the shared barbuttonitem to get the info button. In the interface Builder. Is this something that can be done, or should I just manage and write code?

+3


source to share


1 answer


Try it...



let     infoButton        = UIButton.init( type: .infoLight )
let     infoBarButtonItem = UIBarButtonItem.init( image:  infoButton.image( for: .normal ),
                                                  style: .plain,
                                                  target: self,
                                                  action: #selector( infoBarButtonItemTouched ) )

      

0


source







All Articles