美文网首页
整体截图,设置起点大小截图

整体截图,设置起点大小截图

作者: 疯子不爱看美剧 | 来源:发表于2019-06-04 10:18 被阅读0次

-(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;

}

相关文章

网友评论

      本文标题:整体截图,设置起点大小截图

      本文链接:https://www.haomeiwen.com/subject/gjflxctx.html