View image in full screen just like Facebook app on IOS

I want to make a transition when I touch the image to open full screen just like the Facebook app. When the user touches the image, the transition resets the image to the center, the user clicks on the image again, he returns to the previous page. How can i do this? At the moment I have 1 viewcontroller containing the image in the center. I have used the below code to create an animation when the view viewcontroller is clicked, but it seems to be wrong.

This is my code:

CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFromTop; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
//transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];

      

[self.navigationController pushViewController: imageView animated: NO];

Please give me some advice. Thank.

+3


source to share





All Articles