I am having a problem redrawing to a CATiledLayer while increasing the parent UIScrollView.
I am providing a PDF page in a UIView with CATiledLayer support. It has another UIImageView that contains the low resolution image of the page that CATiledLayer will draw. When I zoom in, it works as expected. CATiledLayer will display a higher resolution image according to the zoom level.
The problem occurs after scaling. If I zoom in, then just leave the iPad alone, the displayed image is blurred and then dragged. It seems that the CATiledLayer is being deleted, since I see a low-resolution blurry image in the backup view, then the CATiledLayer gets the redrawn image, that is, I see the tile effect and the image is redrawn. This happens if I just leave the application alone and wait 30 to 40 seconds. I just watched it on the 3rd generation iPad (new iPad, iPad3, whatever). I am also testing iPad2, and I still have to solve this problem.
Has anyone else encountered this problem? Any known cause and possibly solutions?
Edit:
My UIScrollViewDelegate methods are as follows:
- (void)positionBufferedPages {
[previousPage.view setCenter:...];
[nextPage.view setCenter:...];
}
- (void)hideBufferedPages {
if ([previousPage.view isDescendantOfView:scrollView]) {
[previousPage.view removeFromSuperview];
}
if ([nextPage.view isDescendantOfView:scrollView]) {
[nextPage.view removeFromSuperview];
}
}
- (void)showBufferedPages {
if (![previousPage.view isDescendantOfView:scrollView]) {
[scrollView addSubview:previousPage.view];
}
if (![nextPage.view isDescendantOfView:scrollView]) {
[scrollView addSubview:nextPage.view];
}
if (![currentPage.view isDescendantOfView:scrollView]) {
[scrollView addSubview:currentPage.view];
}
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return currentPage.view;
}
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view {
[self hideBufferedPages];
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollViewParam withView:(UIView *)view atScale:(float)scale {
[self positionBufferedPages];
[self showBufferedPages];
}
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
}
, , scrollview . , pdf CATiledLayer, iPad ( ), CATiledLayer .
setNeedsDisplay, setNeedsDisplayInRect:, setNeedsLayout setNeedsDisplayOnBoundsChange: , , . drawLayer:inContext: , , , ( , ), .
!