views:

370

answers:

2

Hi! How can I draw a button with quartz that has exactly the same style as a UIBarButtonItem. The button should be able to show different colors. I downloaded the Three20 project, but this project is really complex, you'd need a lot of time to overlook the whole framework. I just want to draw a custom UIBarButtonItem.

Thanks for help.

+1  A: 

Try a UISegmentedControl with only one segment and momentary selection. It supports tintColor and might be close enough for your purposes.

Kirk van Gorkom
A: 

If you are using the Three20 library, I guess TTButton's "toolbarButton" style is what you want. TTButton is a sub-class of UIButton, but it allows you to apply styles just like using css while creating a webpage.

To create a button like a UIBarButtonItem, just call

[TTButton buttonWithStyle:@"toolbarButton:" title:@"Title"]

You may need to retain it since the button is an auto-release object.

zonble