我有一个包含3个子视图的父UIView,这里我有一个UIButton来捕捉整个视图。我用
完成了这个UIGraphicsBeginImageContext(CGSizeMake(320,480));
CGContextRef context = UIGraphicsGetCurrentContext();
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.view.layer renderInContext:context];
这里我只需捕获名为subview1的第一个子视图。我怎么能这样做?
答案 0 :(得分:1)
Capture
SubView
:
UIGraphicsBeginImageContext(subview1.size);
[subview1.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();