si può fare con questo frammento:
// Set top right & left corners
[self setMaskTo:yourView byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight];
EDIT
Scusa, ho dimenticato questa
- (void)setMaskTo:(UIView*)view byRoundingCorners:(UIRectCorner)corners
{
UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds
byRoundingCorners:corners
cornerRadii:CGSizeMake(8.0, 8.0)];
CAShapeLayer *shape = [[CAShapeLayer alloc] init];
[shape setPath:rounded.CGPath];
view.layer.mask = shape;
}
PS: come ho detto nel commento, se usi cose come questa quando mostri le celle UITableViewCell
, io ho fo e che è sempre una scelta migliore usare le immagini di sfondo perché questo genere di cose da disegno influisce sempre sulle prestazioni.
http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview?rq=1 –
possibile duplicato di [come impostare cornerRadius solo in alto a sinistra e in alto -dell'angolo di un UIView?] (http://stackoverflow.com/questions/10167266/how-to-set-cornerradius-for-only-top-left-and-top-right-corner-of-a-uuiview) –