UIImage *normal = [UIImage imageNamed:@"chatto_bg_normal"];// 这个是最终形状的图片。
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)]; //这个要被裁剪的view
UIImageView *imageViewMask = [[UIImageView alloc] initWithImage:normal];
imageViewMask.frame = CGRectInset(imageView.frame, 0.0f, 0.0f);
imageView.layer.mask = imageViewMask.layer;
[self.view addSubview:imageView];
时间: 2024-10-24 10:26:21