iOS UIButton selected状态下设置UIControlStateSelected状态下的背景图片 有个蓝色小方块

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/HDFQQ188816190/article/details/86063758

如下代码:

  UIButton *button = [UIButton buttonWithType:(UIButtonTypeSystem)];
    button.frame = CGRectMake(100, 100, 50, 50);
    button.backgroundColor = [UIColor blueColor];
    [button setBackgroundImage:[UIImage imageNamed:@"gl_icon_location_share_on"] forState:(UIControlStateSelected)];
    [self.view addSubview:button];
    button.selected = YES;

左上角有个蓝色小矩形。

解决办法:

    button.tintColor = [UIColor clearColor];

 

 

-- NORMAL --
展开阅读全文

没有更多推荐了,返回首页