Iphone 如何使pdf页面适合vfr阅读器的屏幕大小
在你的iPhone应用程序中有没有使用过vfr阅读器。我使用这个vfr阅读器来显示pdf页面。我需要的是,当用户将方向从纵向更改为横向时,我需要使pdf页面适合整个屏幕。我怎样才能做到这一点 这只是找到正确的缩放因子和设置内容偏移量的问题。在ReaderContentView.m中,将以下函数添加到文件顶部Iphone 如何使pdf页面适合vfr阅读器的屏幕大小,iphone,objective-c,ipad,Iphone,Objective C,Ipad,在你的iPhone应用程序中有没有使用过vfr阅读器。我使用这个vfr阅读器来显示pdf页面。我需要的是,当用户将方向从纵向更改为横向时,我需要使pdf页面适合整个屏幕。我怎样才能做到这一点 这只是找到正确的缩放因子和设置内容偏移量的问题。在ReaderContentView.m中,将以下函数添加到文件顶部 static inline CGFloat ZoomScaleThatFills(CGSize target, CGSize source) { return (target.wid
static inline CGFloat ZoomScaleThatFills(CGSize target, CGSize source)
{
return (target.width / source.width);
}
在同一文件中,在updateMinimumMaximumZoom函数中,按如下方式更改行:
CGFloat zoomScale = ZoomScaleThatFills(targetRect.size, theContentView.bounds.size);
[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));
最后,在initWithFrameFunction中,几乎在最末端更改行,如下所示:
CGFloat zoomScale = ZoomScaleThatFills(targetRect.size, theContentView.bounds.size);
[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));
对我来说就是这样,希望对你也一样 完美-我试着在一段时间内完成这项工作-干得好拇指助手有人能详细解释一下目标应该是什么和来源应该是什么吗?我设置目标aas视图框架和源作为读卡器框架,宽度正常,但高度不能正常工作