2

嗨,我有几个图像被一个不可见的按钮覆盖。当我按下隐形按钮时,有没有办法让它看起来像被按下的图像?谢谢!

4

1 回答 1

0

您可以将图像直接放在按钮上,不需要单独的UIImageView.

[button setBackgroundImage:image forState:UIControlStateNormal];
[button setBackgroundImage:image forState:UIControlStateSelected];

还有几个UIControlState常数。

看看文档:

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIButton_Class/UIButton/UIButton.html

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIControl_Class/Reference/Reference.html#//apple_ref/c/tdef/UIControlState

于 2013-01-03T22:18:11.877 回答