UIScrollView and CATiledLayer
I am using a CATiledLayer as content of UIScrollView, but seems I can not get the correct (sometimes) [scrollView contentSize] and [scrollView contentOffset] from CATiledLayer's delegate method :
- (void)drawLayer:(CALayer *)laye开发者_如何学编程r inContext:(CGContextRef)ctx
I know CATiledLayer uses this method to render tile in a background thread. And I need to use contentSize and contentOffset to calculate some data (some coordinates). The app ran fine on simulator but on device, it sometimes got the wrong contentSize and contentOffset
CATiledLayer does not calculate these values for you, you have to set them.
note that for the tile size it does not apply contentScale. So on Retina the individual tiles are half as big as you specify.
If you still want an answer for this you have to clarify the question.
精彩评论