Custom UIToolBar from Images
Asked Answered
A

3

8

I need to create a UIToolbar object that uses an image for the background. Most of the buttons are images as well, and rectangular. One button, however, is round and overlaps the toolbar like the Start button on the Windows task bar. See below.

I know that I will need to subclass the UIToolbar to paint the image for the toolbar -- I think. If so, does anyone have example code showing how to do this?

Furthermore, does anyone have any ideas on how to implement the larger round button? I'm thinking of another custom subclass for this, but not sure if there might be an easier way.

I can have the art guys chop the image anyway needed, which I'm sure the round button will need to be chopped some how.

Any ideas or sample code?

alt text http://iphone.sophtware.com/toolbar.png

Armagh answered 5/5, 2010 at 0:6 Comment(0)
S
3

Maybe you'll find some inspiration at this tutorial : Recreating The Raised Center Tab Bar Button of Instagram, DailyBooth & Path

Suppuration answered 30/11, 2011 at 8:36 Comment(0)
S
2

For the color, you can experiment with the tintColor property.

As for the rest, UIToolbar is not designed for this. You will need a custom component (probably based on UIView).

Stogner answered 2/6, 2010 at 12:50 Comment(1)
Thank you for the down vote after more than a year without a comment.Stogner
K
0

I think it is possible but hard. Override the drawRect method of the toolbar to draw the whole image. Then add left and right buttons. For the round button you can add one invisible button on the bottom middle of the View and another invisible button in the middle of toolbar. Of course, you can try to use the views instead of the buttons and track the user interaction manually.

Kirksey answered 30/11, 2011 at 7:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.