赞
踩
1:给UIView及其子类设置阴影
- UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(40, 40, 200, 100)];
- [demoView setBackgroundColor:[UIColor whiteColor]];
- [demoView.layer setShadowOffset:CGSizeMake(10, 10)];
- [demoView.layer setShadowColor:[[UIColor redColor] CGColor]];
-
- [self.view addSubview:demoView];
- [demoView release];
2:给UIView设置边框
在之前的代码中添加两行代码:
[demoView.layer setBorderColor:[[UIColor blueColor] CGColor]];
[demoView.layer setBorderWidth:2.0f];
这样。就可以显示UIView的边框。
3:圆角化
继续添加代码:
[demoView.layer setCornerRadius:15];
截图:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。