我正在开发一个iOs 5 iPhone应用程序,当用户按下故事板中的视图按钮时,我想以编程方式截取屏幕截图.我尝试了很多代码,但它们适用于旧版本的iOs.我怎么能在iOs 5中做到这一点.谢谢!!
Sim*_*iwi 12
- (void)drawRect:(CGRect)rect {
UIGraphicsBeginImageContext(self.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5579 次 |
| 最近记录: |