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?
精彩评论