简体   繁体   中英

UIImageView Question - iPhone SDK

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM