rayon d'angle Parfois, avec bordure blanche ne fonctionne pas correctement donc j'utiliser UIBezierPath
et CAShapeLayer
.
Pour faire le rayon d'angle
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:self.imageView.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.view.bounds;
maskLayer.path = maskPath.CGPath;
self.imageView.layer.mask = maskLayer;
Pour rendre la bordure blanche
CAShapeLayer* borderShape = [CAShapeLayer layer];
borderShape.frame = self.imageView.bounds;
borderShape.path = maskPath.CGPath;
borderShape.strokeColor = [UIColor whiteColor].CGColor;
borderShape.fillColor = nil;
borderShape.lineWidth = 3;
[self.imageView.layer addSublayer:borderShape];
Il fonctionnera. Espérons que cette aide
CALayer fait partie de Core Animation, pas UIKit. Par conséquent, il prend un CGColor, pas UIColor. – MarkPowell
Oh oui, désolé je ne faisais que taper ça de ma tête. –