开发者

How to check if a button's image = nil?

开发者 https://www.devze.com 2023-03-14 03:23 出处:网络
I would like to check if one of my UIButton\'s image is equal to nil. Is there a way to do so? I wasn\'t sure abo开发者_如何学Pythonut myButton.image as it\'s not on Apple\'s developer Reference.Appar

I would like to check if one of my UIButton's image is equal to nil. Is there a way to do so? I wasn't sure abo开发者_如何学Pythonut myButton.image as it's not on Apple's developer Reference.


Apparently a UIButton has a property called currentImage and currentBackgroundImage. It will check for the current image (depending on state, for example pressed state or normal state).


Use - (UIImage *)imageForState:(UIControlState)state.

0

精彩评论

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