I'd like to create image mask like following screenshot.
I put UIImageView in UIScrollView. and set the scroll view frame match the center white square.
in scrollview delegate, I changed the scrollview bounds. then we can see photo extend outside of the white border.
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
self.imgScrollView.bounds = self.imageView.frame;
}
After zoom-in, from log I can see scrollview frame is changed too.
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView
withView:(UIView *)view
atScale:(CGFloat)scale {
NSLog(@"= = = = = = = = = = =");
[self logName:@"IMAGEVIEW" ofView:self.imageView];
[self logName:@"SCROLLVIEW" ofView:self.imgScrollView];
}
If I set frame back to white square at delegate, the bounds will be set back too! Then image outside of the white border won't be drawn.
If there any way I can achieve this?