开发者

multiple UIImageView controlled by multiple UIButtons

开发者 https://www.devze.com 2023-04-02 05:24 出处:网络
Here\'s my problem.I need 3 UIImageViews controlled by 3 different UIButtons.I need all 3 butto开发者_C百科ns to control one UIImageView and when done, move to the next UIImageView without affecting t

Here's my problem. I need 3 UIImageViews controlled by 3 different UIButtons. I need all 3 butto开发者_C百科ns to control one UIImageView and when done, move to the next UIImageView without affecting the 1st UIImageView. I'm wondering if I can have a button that "activates" the 1st UIImageView and is controlled by the 3 buttons, then another button that "activaes" the 2nd UIImageView and is controlled by the same 3 buttons.... all without affecting the first UIImageView. I hope this all makes sense.


You will have to write a custom subclass of UIViewController that implements this logic.


It sounds like all three images are in the same UIViewController, and you just want to change the behavior of the buttons that operate on those images?

You can even use the images as a button, if you like, by creating a custom button and using the image as the background or foreground image.

It really is a question of keeping track of your mode. When the first image is active, you can be in mode 1, the second mode 2, etc. Then your three button code can be: if (mode == 1) { // do stuff for first image } else if (mode == 2) { //do stuff for second image } else { // do something for third image }

0

精彩评论

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