我現(xiàn)在使用如下方法對屏幕截圖:UIGraphicsBeginImageContext(self.view.bounds.size);[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];currentCaptureImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();
2 回答

汪汪一只貓
TA貢獻1898條經(jīng)驗 獲得超8個贊
CGRect rect =self.view.frame;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
float originX ;
float originy ;
float width ;
float height ;
//你需要的區(qū)域起點,寬,高;
CGRect rect1 = CGRectMake(originX , originY , width , height);
UIImage * imgeee = [UIImage imageWithCGImage:CGImageCreateWithImageInRect([img CGImage], rect1)];

PIPIONE
TA貢獻1829條經(jīng)驗 獲得超9個贊
主要就是下面這句
UIImage *resultImg = [UIImage imageWithCGImage:CGImageCreateWithImageInRect(img.CGImage, rect)];
- 2 回答
- 0 關(guān)注
- 316 瀏覽
添加回答
舉報
0/150
提交
取消