制作蒙板(ios)


已知:1.图片: UIImage *normal ;(被赋值,此值为一个蒙板的形状)

        normal = [UIImage imageNamed:@"chatfrom_bg_normal"];

        normal = [normal resizableImageWithCapInsets:UIEdgeInsetsMake(35, 22, 10, 10)];

     

    2. [self makeMaskView:self.btnContent.backImageView withImage:normal];


       - (void)makeMaskView:(UIView *)view withImage:(UIImage *)image

      {

          UIImageView *imageViewMask = [[UIImageView alloc] initWithImage:image];

          imageViewMask.frame = CGRectInset(view.frame, 0.0f, 0.0f);

          view.layer.mask = imageViewMask.layer;

      }

 
      注:view为显示的图片




你可能感兴趣的:(移动开发,ios,图片)