3

I know how to create a toolbar button programmatically using UIButton:buttonWithType: and UIBarButtonItem:initWithCustomView: and supplying UIButton:buttonWithType the argument UIButtonTypeInfoLight.

What I'd really like to do is drag a system button onto a generic barbuttonitem to get an info button. In Interface Builder. Is this something one can do or should I just man up and write the code?

2
  • i.e. you just want to have a custom barButtonItem? Jan 29, 2013 at 1:06
  • 2
    No, you can't do that. Man up.
    – rdelmar
    Jan 29, 2013 at 1:10

1 Answer 1

0

Try this...

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.