记录截取tableview图的方法
// 截图 - (void)screenShots{ UITableView *shadowView = mainTab; // 开启图片上下文 UIGraphicsBeginImageContextWithOptions(shadowView.contentSize, NO, 0.f); // 保存现在视图的位置偏移信息 CGPoint saveContentOffset = shadowView.contentOffset; // 保存现在视图的frame信息 CGRect saveFrame = shadowView.frame; // 把要截图的视图偏移量设置为0 shadowView.contentOffset = CGPointZero; // 设置要截图的视图的frame为内容尺寸大小 shadowView.frame = CGRectMake(0, 0, shadowView.contentSize.width, shadowView.contentSize.height); // 获取当前上下文 CGContextRef ctx = UIGraphicsGetCurrentContext(); // 截图:实际是把layer上面的东西绘制到上下文中 [shadowView.layer renderInContext:ctx]; //iOS7+ 推荐使用的方法