我试图在一个单元UITableView格内截取屏幕截图,但附加代码我只能截取单元格界限.问题在于UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f).我只能制作rect大小的截图,不能控制rect和的起源
rect = [cell bounds].所以请建议我一些想法.
{
UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:path];
__block CGRect rect = [cell bounds];
UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[cell.layer renderInContext:context];
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
Run Code Online (Sandbox Code Playgroud)