CATiledLayer is removed and updated with an increase in the number of iPad 3rd generation

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:

// currentPage, previousPage, and nextPage are the pdf page views
// that are having the refresh problem 

- (void)positionBufferedPages { 
  // performs math {code omitted}

  // then sets the center of the views
  [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 {
  // nothing relating to the pdf page view
  // but does set the center of some other subviews on top of the pdf page views
}

, , scrollview . , pdf CATiledLayer, iPad ( ), CATiledLayer .

setNeedsDisplay, setNeedsDisplayInRect:, setNeedsLayout setNeedsDisplayOnBoundsChange: , , . drawLayer:inContext: , , , ( , ), .

!

+5
4

? CATiledLayer , . , , , ( , ). , . , OpenGL ES Driver, , .

+1

. UIGraphicsBeginImageContext(); , . UIGraphicsBeginImageContextWithOptions(), scale (= third) 0.0.

Zooming PDF Viewer Apple, , , .

+1

Longshot, , - ? , .

+1

Apple , , iOS , CATiledLayer Retina iPad, , .

CATileLayers . CATiledLayer, .

+1

All Articles