【发布时间】:2011-10-21 13:32:47
【问题描述】:
在我的应用中:
我有一个带有 clipsToBound = YES 的视图 (UIView *myView);
我有一个按钮可以更改边界属性的原点:
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
请帮帮我!
【问题讨论】:
-
我不认为 myView.layer.frame = newRect;是必要的,请尝试删除它。
-
亲爱的,移动它并不能解决问题。
标签: iphone ios render layer bounds