Reputation: 2908
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
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
Reputation: 11037
Upvotes: 0
Reputation: 9346
You can have a look here: http://www.cimgf.com/2010/01/28/fun-with-uibuttons-and-core-animation-layers/
Upvotes: 0