I have view controller, and inside that I have a UIScrollView
, for managing the zoom, and a UIImage
.
Now I'm handling the zoom effect with UIScrollViewDelegate
delegate and method viewForZoomingInScrollView:
... but the result is very poor, definitely not fluid!
This is my code:
#import "ImageViewController.h"
@interface ImageViewController () <UIScrollViewDelegate, UIActionSheetDelegate>
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
@implementation ImageViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.scrollView.delegate = self;
self.scrollView.maximumZoomScale = 3.0;
// some code
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return self.imageView;
}
// last update
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
if ([self.scrollView zoomScale] < 1.0) {
[self.scrollView setZoomScale:1.0];
}
}
// some other methods...
@end
This is the storyboard view:
I'm not using a Pinch Gesture Recognizer. All images are quite small like 640x480.
Thanks
P.S. this is a continue of UICollectionView and images.