1
viewObj.layer.cornerRadius = 5.0;
viewObj.layer.masksToBounds = YES;
2
在该对象的类的drawRect方法中中加上
- (void)drawRect:(CGRect)rect {
CGFloat cornerRadius = 8.0;
CGFloat width = rect.size.width;
CGFloat height = rect.size.height;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
[path addClip];
}
网友评论