在我的应用程序中:
我有一个带有 clipsToBound = YES 的视图(UIView *myView);
我有一个按钮可以更改 bounds 属性的来源:
CGRect newRect = myView.bounds; newRect.origin.x += 100; myView.bounds = newRect; myView.layer.frame = newRect;
- 然后我从视图中获取图像:
UIGraphicsBeginImageContext(myView.bounds.size); [myView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage_after = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage_after, nil, nil, nil);
它产生了我没想到的图像。我想要在 iPhone 屏幕上看到的图像。
此处的代码链接: http ://www.mediafire.com/?ufr1q8lbd434wu1
请帮我!