Suk*_*dal 6 objective-c ipad ios
在我的iPAD应用程序中,我有两个viewcontrollers,第一个viewcontroller有一个按钮,我想在我点击该按钮时获取第二个viewcontroler的快照,而不在iPAD屏幕中加载第二个viewcontroller.如果我加载viewcontroler然后拍摄快照然后它正在工作但我的要求是做同样的事情而不在屏幕上加载viewcontroler.请提供想法或链接或代码段.
小智 10
试试这个: - 制作你要拍摄的VC实例,然后在这个方法中传递对象.
+ (UIImage *)renderImageFromView:(UIView *)view withRect:(CGRect)frame {
// Create a new context the size of the frame
UIGraphicsBeginImageContextWithOptions(frame.size, YES, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
// Render the view
[view.layer renderInContext:context];
//[view drawRect:frame];
// Get the image from the context
UIImage *renderedImage = UIGraphicsGetImageFromCurrentImageContext();
// Cleanup the context you created
UIGraphicsEndImageContext();
return renderedImage;
}
| 归档时间: | 
 | 
| 查看次数: | 4163 次 | 
| 最近记录: |