-(NSMutableArray*)fullScreenshots:(UIView*)view{
UIGraphicsBeginImageContext(view.frame.size);//全屏截图,包括window
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
intViewHeight = view.frame.size.height;
intnum =0;
if(ViewHeight<=A4_Heigt) {
num =1;
}else{
num = ViewHeight%A4_Heigt==0?ViewHeight/A4_Heigt:ViewHeight/A4_Heigt+1;
}
NSMutableArray *imgarry = [NSMutableArray new];
for(inti =0; i
floatoriginX =view.frame.origin.x;
floatoriginy =view.frame.origin.y+A4_Heigt*i;
floatwidth =A4_Widh;
floatheight =A4_Heigt;
//你需要的区域起点,宽,高;
CGRectrect1 =CGRectMake(originX , originy , width , height);
UIImage * imgeee = [UIImage imageWithCGImage:CGImageCreateWithImageInRect([viewImage CGImage], rect1)];
[imgarryaddObject:imgeee];
}
returnimgarry;
}
网友评论