iphone初学者,制作pdf,我做错了什么
我正在制作一个pdf应用程序,在其中我遇到了问题iphone初学者,制作pdf,我做错了什么,iphone,pdf,Iphone,Pdf,我正在制作一个pdf应用程序,在其中我遇到了问题 // make pdf NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; BOOL isFileCreated; if(isPortrait)
// make pdf
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
BOOL isFileCreated;
if(isPortrait)
{
isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-340, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil);
}
else
{
isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-250, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil);
}
if(isFileCreated)
{
UIGraphicsBeginPDFPage();
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndPDFContext();
}
这段代码只创建了一半的pdf。当前显示在屏幕上的内容和pdf的其余部分丢失,当前未显示在屏幕上。我该怎么办?
提前谢谢。
或
我在这里使用UIGraphicsGetCurrentContext()方法。我认为它只渲染当前显示的区域。是否有任何方法可以渲染所有视图区域。