0

我有一个包含 3 个子视图的父 UIView,这里我有一个 UIButton 来捕捉整个视图。我已经这样做了

UIGraphicsBeginImageContext(CGSizeMake(320,480));
CGContextRef context = UIGraphicsGetCurrentContext();

UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); 

[self.view.layer renderInContext:context];

在这里,我只需要捕获名称为 subview1 的第一个子视图。我怎样才能做到这一点?

4

1 回答 1

1

Capture SubView像这样:

UIGraphicsBeginImageContext(subview1.size);
[subview1.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); 
于 2012-10-31T06:48:25.320 回答