0
我從UIScrollView創建PDF。如何在轉換後取消隱藏ScrollView PDF應用程序
它工作正常,並創建一個PDF,但問題是,創建PDF後,scrollView從屏幕消失,當我再次加載應用程序,然後再次顯示,所以我認爲由於PDF創建它隱藏任何方式在創建PDF後取消隱藏它。
我使用下面的代碼:
-(void)createPDFfromUIView: (UIView*)aView saveToDocumentsWithFileName: (NSString*)aFilename
{
NSMutableData *pdfData = [NSMutableData data];
CGRect scrollSize = CGRectMake(1018,76,1010,1600);
[scrollView setFrame:CGRectMake(1018,76,1010,1600)];
// Points the pdf converter to the mutable data object and to the UIView to be converted
UIGraphicsBeginPDFContextToData(pdfData,scrollView.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
// draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
[aView.layer renderInContext:pdfContext];
// remove PDF rendering context
UIGraphicsEndPDFContext();
// Retrieves the document directories from the iOS device
NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
NSString* documentDirectory = [documentDirectories objectAtIndex:0];
NSString* documentDirectoryFilename = [documentDirectory stringByAppendingPathComponent:aFilename];
// instructs the mutable data object to write its context to a file on disk
[pdfData writeToFile:documentDirectoryFilename atomically:YES];
NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename);
}
因此可能會在createPDF –
的調用方法後添加此行,但爲什麼要設置這樣的奇數幀?任何特殊需求 – Iducool
它來自界面構建器值和橫向模式 –