我使用下面的代码来捕获父视图的图像,以便在模态视图中用作背景。但是在iOS 5中它不再起作用(下面的变量“parentViewImage”为空)。有人可以帮忙吗?
// grab an image of our parent view
UIView *parentView = self.parentViewController.view;
UIGraphicsBeginImageContext(parentView.bounds.size);
[parentView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *parentViewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();