我正在制作一个我遇到问题的pdf应用程序
// 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丢失,目前屏幕上没有显示。我该怎么办? 提前谢谢。