开发者

UIImageView Question - iPhone SDK

开发者 https://www.devze.com 2023-01-04 04:07 出处:网络
I want to write an \"if\" statement of an uiimageview to see which image is in the image currently. So if the uiimageview has this certain image, lets say \"hello.png\", then开发者_如何学运维 do this

I want to write an "if" statement of an uiimageview to see which image is in the image currently. So if the uiimageview has this certain image, lets say "hello.png", then开发者_如何学运维 do this action. If it has "bye.png" then do this action.

Thanks,

Kevin


I would do that by a BOOL field in your Model instead of checking the UIImageView.

You can update the boolean flag at the same time you update your imageview.

MVC - Model View Controller.

Do not relly on view-related items for business logic. You might change to a "MovieViewController" (I know it doesn't exist!) in the future and having the separation of concerns is the best.


UIImageView objects don't keep a name as part of the object. You need to keep track of what file is in what image view either by subclassing and adding a name attribute or some other means.

0

精彩评论

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

关注公众号