Reputation: 2982
how can you make a UIImage go full screen, but not the actual frame of the image, but like the photos in the iOS photos app, where you tap a photo and it goes to a special full screen mode, where you can zoom in etc. many thanks!
Upvotes: 1
Views: 1414
Reputation: 13549
Add a UIImageView
as subview to a UIScrollView
with it's frame equal to the size of the screen.
Set your UIScrollViewDelegate
and implement the delegate method:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return self.yourImageView;
}
Attach two tap gesture recognizers to the imageView:
Implement your tapGestureRecognizer selectors and direct the zoom logic using:
CGPoint location = [tapRecognizer locationInView:self.yourImageView]; // Location of tap
and
[self.scrollView zoomToRect:whateverRect animated:YES]; //Zooming in/out to locations
[self.scrollView setZoomScale:whateverScale animated:YES];
Upvotes: 1