为UIView及其子类添加圆角边框

为UIView及其子类添加圆角边框

1.添加QuartzCore.framework

2.实现代码

  1. UIView *bfPanel = [[UIView alloc]initWithFrame:CGRectMake(x, y, width, height)];  
  2. bfPanel.layer.masksToBounds = YES;  
  3. bfPanel.layer.borderWidth  =1;  
  4. bfPanel.layer.cornerRadius = 10;  
  5. bfPanel.layer.borderColor= [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];  
  6. [mainView addSubview:bfPanel];  
  7. y +=height+10;  

 转自:http://gekie.iteye.com/blog/1088427

你可能感兴趣的:(为UIView及其子类添加圆角边框)