如何根据自己的需要裁剪控件的边角

如何根据自己的需要裁剪控件的边角_第1张图片

UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 300, 100, 100)];

imageView.image = [UIImage imageNamed:@"屏幕快照 2016-01-06 17.44.20"];

[self.view addSubview:imageView];

UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(20, 20)];

CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init];

maskLayer.frame = imageView.bounds;

maskLayer.path = maskPath.CGPath;

imageView.layer.mask = maskLayer;

你可能感兴趣的:(如何根据自己的需要裁剪控件的边角)