UITextfield、UITextview、UIImageを含むさまざまなセルでUITableを作成しようとしています。画像やテキストを含むすべてのセルを含むレポートのようなPDFを生成したいと思います。
UITableviewcellのスクリーンショットを1つ作成するためのコードがあります。しかし、複数のスクリーンショットを作成し、それらをマージして1つのPDFファイルを作成する方法がわかりません。
以下は、UITableviewcellのスクリーンショットを作成するために持っているコードです。ありがとう
NSUInteger index[] = {0, 0}; // section, row
NSIndexPath *indexPath = [[NSIndexPath alloc] initWithIndexes:index length:2];
// Get the cell
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
// Render a graphics context to turn your cell into a UIImage
CGSize imageSize = cell.bounds.size;
UIGraphicsBeginImageContext(imageSize);
CGContextRef imageContext = UIGraphicsGetCurrentContext();
[cell.layer renderInContext:imageContext];
// Retrieve the screenshot image
UIImage *imagefinal = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(imagefinal, nil, nil, nil);