iOS截图

UIView *cutView = self.view.window.rootViewController.view;    
//截图    
//开启上下文      
UIGraphicsBeginImageContextWithOptions(cutView.frame.size, YES, 0.0);    
//把cutView渲染到上下文中    
[cutView.layer renderInContext:UIGraphicsGetCurrentContext()];    
UIImage *image  = UIGraphicsGetImageFromCurrentImageContext();     
//结束上下文    
UIGraphicsEndImageContext();

 

posted @ 2015-04-07 19:09  嗷大喵  阅读(162)  评论(0)    收藏  举报