开发者

Custom UIToolBar from Images

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 s开发者_JAVA技巧ample code?

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


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


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜