Cosmin
Cosmin

Reputation: 2908

Add gradient to Back button of my UINavigationBar

I have subclassed UINavigationBar and overridden drawRect method so I can add a gradient to it. Now, I want to use the same gradient to the back button, but I don't know what is the easiest way (subclass UIButton, subclass UIBarButton item)

Thank you.

Upvotes: 0

Views: 686

Answers (3)

David Chu
David Chu

Reputation: 329

A lot of people on StackOverflow caution against subclassing UIButton. create uibutton subclass

The easiest way to do what you want is to use [UIButton buttonWithType:UIButtonTypeCustom].

Make a transparent .png image of your button and set it as your button.image.

Upvotes: 1

Related Questions