首页 > 代码库 > IOS view的圆角和阴影并存
IOS view的圆角和阴影并存
UIView *v=[[UIView alloc]initWithFrame:CGRectMake(10, 10, 100, 100)];
v.backgroundColor=[UIColor yellowColor];
//v.layer.masksToBounds=YES;这行去掉
v.layer.cornerRadius=10;
v.layer.shadowColor=[UIColor redColor].CGColor;
v.layer.shadowOffset=CGSizeMake(10, 10);
v.layer.shadowOpacity=0.5;
v.layer.shadowRadius=5;
[self.view addSubview:v];
效果如下
/* When true an implicit mask matching the layer bounds is applied to
* the layer (including the effects of the `cornerRadius‘ property). If
* both `mask‘ and `masksToBounds‘ are non-nil the two masks are
* multiplied to get the actual mask values. Defaults to NO.
* Animatable. */
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。