I was reading over this thread and this article
My question is how to get the content from my view into the CreateMethod. In the article it has a call like this:
NSString *content = textView.text; //this is the UITextView, co开发者_如何学Gontaining our text.
How do I get the content since I'm using a UITable View. . . Actually I'd like to get the entire view with all the information before the table as well.
Any ideas or at least a push in the right direction?
You can draw the UITableView as an image - it's probably not great (you may wanna text), but this would be relatively cheap. This is just a skeleton, to get the idea:
if (!UIGraphicsBeginPDFContextToFile(newFilePath, page, metaData )) {
NSLog(@"error creating PDF context");
return;
}
UIGraphicsBeginPDFPage();
[tableView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndPDFContext();
[tableView.layer renderInContext:UIGraphicsGetCurrentContext()];
it render the table view & grab all table view & make pdf of the table view.
精彩评论