美文网首页
常用的分类

常用的分类

作者: IceWall_Rin | 来源:发表于2016-05-27 15:22 被阅读12次

    转换坐标系

    图像截屏

    - (UIImage *)screenShotOfView:(UIView *)view

    {

    UIGraphicsBeginImageContextWithOptions(self.imageView.frame.size, YES, 0.0);

    [self.imageView drawViewHierarchyInRect:self.imageView.frame afterScreenUpdates:NO];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return image;

    }

    水印

    - (UIImage *)addlogoImage:(UIImage *)resizedImage

    {

    UIGraphicsBeginImageContext(resizedImage.size);

    [resizedImage drawInRect:CGRectMake(0, 0, resizedImage.size.width, resizedImage.size.height)];

    UIImage *maskImage  = [UIImage imageNamed:@"dzh_logo.png"];

    [maskImage drawInRect:CGRectMake((resizedImage.size.width - maskImage.size.width)/2,

    (resizedImage.size.height - maskImage.size.height)/2,

    maskImage.size.width,

    maskImage.size.height)];

    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return resultingImage;

    }

    相关文章

      网友评论

          本文标题:常用的分类

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