How to make UIImageView touch to move to another ViewController?

I have a StoryBoard , and the ViewController base includes some images.

How can I touch their image to go to another ViewController associated with the UIImageView from the modal?

+6
source share
3 answers

create a new viewController drag gesture recognition to the first viewController

right click + drag from the gesture recognizer to the new viewController and you will see the modal option

right click + drag from UIImageView to gestureRecognizer and you will see that the gestureRecognizer parameter select it and that is all

Make sure the UIImageView has the "User Iteraction Enabled" ckecked parameter

just added a sample project to github

+2
source

You can try the following movement from one view controller to another:

 [MyImageView.view removeFromSuperview]; [MyNewViewController.view addSubview:MyImageView.view]; 

If you want to animate this change by making it fly, you may need to create an animation for MyImageView.view.frame from the old to the new view controller. To do this, you need to use methods such as

 CGRect fromFrame = [MyImageView.view convertRect:MyImageView.view.frame toView:MyOldViewController] 
+1
source

All Articles