我想将一个头部按钮添加到一个周围有一些空白区域的视图中。我的代码是这样的:
// head button
UIButton * btnHead = [UIButton buttonWithType:UIButtonTypeCustom];
btnHead.frame = CGRectMake(0, 0, self.frame.size.width - property.userhead_cell_space / 2, self.frame.size.width - property.userhead_cell_space / 2);
btnHead.clipsToBounds = YES;
btnHead.layer.cornerRadius = btnHead.bounds.size.width / 2;
btnHead.layer.borderColor = [UIColor whiteColor].CGColor;
btnHead.layer.borderWidth = (isPad?4.0f:2.0f);
btnHead.layer.contentsScale = [[UIScreen mainScreen] scale];
btnHead.layer.backgroundColor = [UIColor whiteColor].CGColor;
[btnHead addTarget:self action:@selector(clickHead:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btnHead];
但它周围总是有锯齿。它可能只有一个像素。但是看起来很可怕。像这样:
有人有一些技巧可以去除黑色锯齿吗?