- //截屏
- - (UIImage *)Screenshot{
- NSArray *navArr = [self.navigationController viewControllers];
- UIViewController *tempVC;
- UIImage *img;
- if(navArr.count >= 3){
- tempVC = [navArr objectAtIndex:navArr.count-2];
- }
- if(tempVC != nil){
- CGRect rect = [tempVC.view bounds];
- rect.origin.y = 20;
- rect.size.height = rect.size.height - 20;
- UIGraphicsBeginImageContext(rect.size);
- CGContextRef context = UIGraphicsGetCurrentContext();
- [tempVC.view.layer renderInContext:context];
- img = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- }
- return img;
IOS开发——截屏
最新推荐文章于 2023-12-16 08:00:00 发布