veces radio de la esquina con borde blanco no funciona correctamente así que uso UIBezierPath
y CAShapeLayer
.
Para hacer que el radio de la esquina
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;
Para hacer que el borde blanco
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];
Se trabajará. Espero que esta ayuda
CALayer es parte de Core Animation, no UIKit. Por lo tanto, se necesita un CGColor, no UIColor. – MarkPowell
Oh sí, lo siento, estaba simplemente tipeando eso de mi cabeza. –