Question: Tried this but only works for UIButton:

```
[btn setTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];

```

Answer: 
If you need this enough times in your code, it's nice to go ahead and extend `UIBarButtonItem` which I've done below in Swift. :)

```
import UIKit

extension UIBarButtonItem {
    func addTargetForAction(target: AnyObject, action: Selector) {
        self.target = target
        self.action = action
    }
}

```

As an example, with self as a `UIViewController`, you'd simply call:

```
self.myBarButtonItem.addTargetForAction(self, action: #selector(buttonPressed(_:))

```
You may want to try out the addTarget method.