捏缩放手势在ipad2上完美运行但在视网膜iPad上没有?

时间:2013-07-11 05:21:06

标签: uiscrollview pinchzoom

问题的标题说明了一切。为了获得更多帮助,我想告诉我,我的应用程序是使用Apple Photo Scroller开发的(Apple的PhotoScroller示例代码的修改,用于在UIViewController子类中加载UIPageViewController ),有多个图像库。问题是在ipad2上完全适用于缩放功能,但在视网膜iPad上却没有。我的图片大小为2048x1536。

有人可以告诉我为什么缩放不适用于视网膜iPad吗?

1 个答案:

答案 0 :(得分:0)

首先检查contentScaleFactor是否设置为1。

来自PhotoScroller的TilingView.m文件:

// to handle the interaction between CATiledLayer and high resolution screens, we need to
// always keep the tiling view's contentScaleFactor at 1.0. UIKit will try to set it back
// to 2.0 on retina displays, which is the right call in most cases, but since we're backed
// by a CATiledLayer it will actually cause us to load the wrong sized tiles.
//
- (void)setContentScaleFactor:(CGFloat)contentScaleFactor
{
    [super setContentScaleFactor:1.f];
}

有关contentScaleFactor的更多信息,请参阅以下相关问题和答案herehere