Reputation: 834
Can i implement both the paging and zooming of imageview in a uiscrollview at the same time.
Upvotes: 3
Views: 4588
Reputation: 51374
Yes. You can do it. In each page of the mainScrollView add a subScrollView containing the imageView. You need to do the following things.
Set maximumZoomScale for subScrollView
[subScrollView setMaximumZoomScale:2.0f]; // You can set any value
This value is calculated based on the size of the image displayed in the imageView.
In the viewForZoomingInScrollView: method of the subScrollView return the imageView
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return imageView;
}
Enable paging in mainScrollView
mainScrollView.pagingEnabled = YES;
You have to write further code to handle paging in the mainScrollView.
Upvotes: 18