CGRect rect = CGRectMake(0, 0, SMALL_RAIDUS, SMALL_RAIDUS);
UIButton * btn = [[ UIButton alloc]initWithFrame:rect];
[btn setBackgroundImage:[UIImage imageNamed:@”icon-aa-twitter”] forState:UIControlStateNormal];
btn.layer.cornerRadius = SMALL_RAIDUS/2;
btn.layer.masksToBounds = YES;
UIButton * btn = [[ UIButton alloc]initWithFrame:rect];
[btn setBackgroundImage:[UIImage imageNamed:@”icon-aa-twitter”] forState:UIControlStateNormal];
btn.layer.cornerRadius = SMALL_RAIDUS/2;
btn.layer.masksToBounds = YES;
[self addSubview:btn];
当使用上面的操作把图片设置为按钮的背景以及设置圆角之后,按钮点击下去之后发现图片有部分显示超过了圆形的按钮,应该怎么样修改?谢谢!
解决方案
10
setBackgroundImage 改为 setImage
10
再设置一张高亮的背景图