Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有几个图像被一个不可见的按钮覆盖。当我按下隐形按钮时,有没有办法让它看起来像被按下的图像?谢谢!
您可以将图像直接放在按钮上,不需要单独的UIImageView.
UIImageView
[button setBackgroundImage:image forState:UIControlStateNormal]; [button setBackgroundImage:image forState:UIControlStateSelected];
还有几个UIControlState常数。
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