如何使pdf页面适合vfr阅读器中的屏幕尺寸 [英] how to make pdf page to fit to screen size in vfr reader

查看:115
本文介绍了如何使pdf页面适合vfr阅读器中的屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您的iPhone应用程序中是否有人使用过vfr阅读器。我正在使用这个vfr阅读器来显示pdf页面。我需要的是当用户将他的方向从纵向更改为横向时我需要使pdf页面适合整个屏幕。我怎样才能做到这一点。

Has any one used vfr reader in your iPhone application. i am using this vfr reader to show pdf pages. what my need is when a user changes his orientation from portrait to landscape i need to make the pdf page to fit to the entire screen. how can i do this.

推荐答案

只需找到正确的缩放系数并设置内容偏移即可。在ReaderContentView.m中,将以下函数添加到文件顶部

Its just a matter of finding the correct Zoom Factor and setting the content offset. In the ReaderContentView.m add the following function to the top of the file

static inline CGFloat ZoomScaleThatFills(CGSize target, CGSize source)
{
    return (target.width / source.width);
}

在同一个文件中,在updateMinimumMaximumZoom函数内更改该行,如下所示: / p>

in the same file, inside the updateMinimumMaximumZoom Function change the line as follows:

CGFloat zoomScale = ZoomScaleThatFills(targetRect.size, theContentView.bounds.size);

最后,在initWithFrameFunction中,几乎在最后更改行如下:

and finally, in the initWithFrameFunction almost at the very end change the lines as follows:

[self updateMinimumMaximumZoom]; // Update the minimum and maximum zoom scales

self.zoomScale = self.minimumZoomScale; // Set zoom to fit page width

// Set Offset to 0 to scroll to top of page         
self.contentOffset = CGPointMake((0.0f - CONTENT_INSET), (0.0f - CONTENT_INSET)); 

这对我有用,希望它对您也有效!

that does it for me, hope it works for you as well!

这篇关于如何使pdf页面适合vfr阅读器中的屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆