您的位置:首页 > 产品设计 > UI/UE

设置uiview圆角与阴影

2012-06-09 11:15 375 查看
CALayer * layer = [theView layer];

[layer setMasksToBounds:YES];
[layer setCornerRadius:theRadius];
[layer setBorderWidth:theBorderWidth];
[layer setBorderColor:theColor.CGColor];

其中:theView(UIView)为目标view

theRadius(float)为圆角半径

theBorderWidth(float)为边框大小

theColor(UIColor)为边框颜色
CALayer * layer = [theView layer];

[layer setShadowOffset:theOffset];
[layer setShadowRadius:theRadius];
[layer setShadowOpacity:theOpacity];
[layer setShadowColor:theColor.CGColor];


其中:theView(UIView)为目标view

theOffset(CGSize)为阴影偏移量,默认为(0, -3)

theRadius(float)为阴影四角圆角半径,默认值为3

theOpacity(float)为阴影透明度(取值为[0,1])

theColor(UIColor)为阴影颜色
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: