【发布时间】:2015-03-23 14:46:01
【问题描述】:
这是我添加到新视图控制器的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 200, 100)];
[contentView setClipsToBounds:YES];
[contentView setBackgroundColor:[UIColor blueColor]];
[self.view addSubview:contentView];
[[contentView layer] setBorderColor:[[UIColor lightGrayColor] CGColor]];
[[contentView layer] setBorderWidth:1.0f];
[[contentView layer] setCornerRadius:5.0f];
[[contentView layer] setMasksToBounds:YES];
}
结果:
如果看角落,我们可以看到外面的蓝色像素:
【问题讨论】:
标签: ios ios7 ios8 calayer cornerradius