将view剪切为各种形状的view(类似微信聊天图片展示)。
时间:2015-05-06 14:47:54
收藏:0
阅读:244
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];
评论(0)