开发者

Combining images to make a UIButton?

If I have one png which is basically a butt开发者_运维问答on image with nothing inside of it:

----------------
|              |
----------------

How do I lay an image onto that, to make the image part of the button, like:

----------------
|    (image)   |
----------------

(I could just lay a UIImageView on top, but that would not inherit button properties, like going dark when pressed)


use the image that is basically a button as the backgroundImage of the UIButton, and use the other image as the image of the UIButton.

[button setImage:[UIImage imageNamed:@"Foo"] forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"Bar"] forState:UIControlStateNormal];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜