开发者

UIScrollView and CATiledLayer

开发者 https://www.devze.com 2022-12-24 11:16 出处:网络
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 :

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消