#pragma mark -
#pragma mark - 截图保存按钮事件
- (void)rightButtonAction:(id)sender{
//获取当前窗口对象
UIImage * image = [self getNormalImage:self.view.window];
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
[MBProgressHUD showSuccess:@"截图成功" toView:self.view];
}
- (UIImage *)getNormalImage:(UIView *)view{
//保存原图
UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
实现类似(Home+关机键)截图效果)
最新推荐文章于 2021-03-14 21:14:53 发布