Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIScrollView和CATiledLayer_Iphone_Objective C_Uiscrollview_Core Animation - Fatal编程技术网

Iphone UIScrollView和CATiledLayer

Iphone UIScrollView和CATiledLayer,iphone,objective-c,uiscrollview,core-animation,Iphone,Objective C,Uiscrollview,Core Animation,我使用CATiledLayer作为UIScrollView的内容,但似乎无法从CATiledLayer的委托方法中获得正确的(有时)[scrollView contentSize]和[scrollView contentOffset]: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx 我知道CATiledLayer使用此方法在背景线程中渲染平铺。我需要使用contentSize和contentOffset来计算一些数

我使用CATiledLayer作为UIScrollView的内容,但似乎无法从CATiledLayer的委托方法中获得正确的(有时)[scrollView contentSize]和[scrollView contentOffset]:

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx

我知道CATiledLayer使用此方法在背景线程中渲染平铺。我需要使用contentSize和contentOffset来计算一些数据(一些坐标)。该应用程序在模拟器上运行良好,但在设备上,它有时会得到错误的contentSize和contentOffset,CATiledLayer不会为您计算这些值,您必须设置它们

请注意,对于平铺大小,它不应用contentScale。因此,在视网膜上,单个瓷砖的大小是您指定的一半


如果您仍然想得到答案,您必须澄清问题。

设备上的contentSize/Offset值有多远?是四舍五入还是整单位?无法将已知为true的contentSize传递给包含drawLayer:inContext:方法的委托吗?在滚动/缩放时不应更改,否则您的平铺将需要重新绘制。-这当然不是你问题的答案。哇,这个问题已经一年了。我想你现在已经明白了。干杯