iOS截圖

UIView *cutView = self.view.window.rootViewController.view;    
//截圖    
//開啓上下文      
UIGraphicsBeginImageContextWithOptions(cutView.frame.size, YES, 0.0);    
//把cutView渲染到上下文中    
[cutView.layer renderInContext:UIGraphicsGetCurrentContext()];    
UIImage *image  = UIGraphicsGetImageFromCurrentImageContext();    
//取出image    
//_imageView.image =    
//結束上下文    
UIGraphicsEndImageContext();
相關文章
相關標籤/搜索