ios 获取一个view上的图片,iphone混合图片 合成图片 任意范围截图 截屏

来源:互联网 发布:北京日上免税店官网mac 编辑:程序博客网 时间:2024/05/16 19:22
        UIGraphicsBeginImageContext(CGSizeMake(640, 960));
        UIImage *topImage = [UIImage imageNamed:@"top.png"],
        *bottomImage = [UIImage imageNamed:@"bottom.png"];
        [topImage drawInRect:CGRectMake(0, 0, 640, 232)];
        [originImage drawInRect:CGRectMake(0, 232, 640, 538)];
        [bottomImage drawInRect:CGRectMake(0, 768, 640, 192)];
        originImage = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();



CGSize shareSize = self.view.bounds.size;
        shareSize = CGSizeMake(shareSize.width, shareSize.height - 45);
        UIGraphicsBeginImageContextWithOptions(shareSize, YES, 0.4);
        [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *uiImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

原创粉丝点击