在我的应用程序:改变的UIView bounds属性在IOS,然后绘制图像
我有一个视图(UIView的* MyView的)wihth clipsToBound = YES;
我有一个按钮做改变边界财产的来源:
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;是必要的,请尝试删除它。 – jbat100
亲爱的,移动它不能解决问题。 –