开发者

How to make buttons with custom shapes?

I'm developing an iPhone 开发者_运维知识库app that requires buttons to be of shapes other than rectangles/squares for eg, an amoeba shaped button. Also, when the button is clicked, the button is highlighted only as much as its size. So just setting a background image only is not enough. How should I go about it?


One way would be to make pre-rendered images for both the normal state and selected state. Then set use setBackgroundImage: forState: to set each image to it's appropriate state.

I should add, your pre-rendered images would include transparency around the "amoeba" shape and would therefore give the illusion of an "amoeba" shaped button. Combining that with a selected state image of the selected state of the "amoeba" shape as well as disabling highlightAdjustsImage should give you the result you desire. Or am I still misunderstanding something?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜