问候,
我正在开发一个受 iOS SDK 附带的“ZoomingPDFViewer”示例启发的应用程序。在某个时候,我发现了以下代码:
// to handle the interaction between CATiledLayer and high resolution
// screens, we need to manually set the tiling view's
// contentScaleFactor to 1.0. (If we omitted this, it would be 2.0
// on high resolution screens, which would cause the CATiledLayer
// to ask us for tiles of the wrong scales.)
pageContentView.contentScaleFactor = 1.0;
我试图更多地了解contentScaleFactor
它以及它的作用。在阅读了所有提到它的 Apple 文档后,我搜索了谷歌,但从未找到它实际作用的明确答案。
以下是一些我很好奇的事情:
在绘制 UIView/CALayer 的内容时,这似乎
contentScaleFactor
对图形上下文有某种影响。这似乎与高分辨率显示器(如 Retina 显示器)有关。contentScaleFactor
真正有什么样的影响?当使用 a
UIScrollView
并将其设置为缩放时,比如说我的contentView;contentView的所有子视图也在缩放。这是如何运作的?哪些属性会UIScrollView
修改以使视频播放器变得模糊和放大?
TL;DR:UIScrollView 的缩放功能是如何“在后台”工作的?我想了解它是如何工作的,以便编写正确的代码。
任何提示和解释都非常感谢!:)