Max
Max

Reputation: 2094

Change iOS UIBarButtonItem Programmatically

Is it possible to change the button type of a UIBarButton in iOS programmatically?

What I mean would be if you had a view with a navigation bar up the top and you have dragged on a UIBarButton which you have set to the "Compose" type so that it shows the icon of the pencil and paper, could you then drag an outlet of this to the view's ViewController and change the button to another type such as "Edit"?

Pseudo code, it might look like:

myBarButton.type = UIBarButtonType.Compose

Or something? Does such a functionality exist for iOS 8 in Xcode with Swift 1.2?

Upvotes: 1

Views: 1076

Answers (1)

Kingofmit
Kingofmit

Reputation: 2066

Well you can put a UIButton Instead of The UIBarButtonItem ! This is the only Way to get what you want.

The UIButton Can be Changed Easily and with anything you want !

Upvotes: 2

Related Questions