- UIView *customView = [[UIView alloc] init];
- [customView setMasksToBounds:YES];
- [customView setCornerRadius:theRadius];
- [customView setBorderWidth:theBorderWidth];
- [customView setBorderColor:theColor.CGColor];
其中:theView(UIView)为目标view
theRadius(float)为圆角半径
theBorderWidth(float)为边框大小
theColor(UIColor)为边框颜色
阴影:
- UIView *customView = [[UIView alloc] init];
- [customView setShadowOffset:theOffset];
- [customView setShadowRadius:theRadius];
- [customView setShadowOpacity:theOpacity];
- [customView setShadowColor:theColor.CGColor];
其中:theView(UIView)为目标view
theOffset(CGSize)为阴影偏移量,默认为(0, -3)
theRadius(float)为阴影四角圆角半径,默认值为3
theOpacity(float)为阴影透明度(取值为[0,1])
theColor(UIColor)为阴影颜色