设置UIView阴影shadow 边框 边框颜色

http://blog.sina.com.cn/s/blog_677089db0100us05.html

http://hi.baidu.com/popln/blog/item/a8f3921e2944701f304e15c3.html

 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    UIView * viewTest=[[UIView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
    viewTest.backgroundColor=[UIColor lightGrayColor];
    //UIView设置阴影
    [[viewTest layer] setShadowOffset:CGSizeMake(1, 1)];
    [[viewTest layer] setShadowRadius:5];
    [[viewTest layer] setShadowOpacity:1];
    [[viewTest layer] setShadowColor:[UIColor blackColor].CGColor];
    //UIView设置边框
    [[viewTest layer] setCornerRadius:5];
    [[viewTest layer] setBorderWidth:2];
    [[viewTest layer] setBorderColor:[UIColor whiteColor].CGColor];
    [self.view addSubview:viewTest];
}

posted on 2012-05-23 17:51  easonoutlook  阅读(433)  评论(0编辑  收藏  举报