美文网首页
iOS 使用xib生成button,使用select属性时背景颜

iOS 使用xib生成button,使用select属性时背景颜

作者: money_ac9e | 来源:发表于2018-07-10 10:39 被阅读0次

    需求:

    人 机 料 等 六个按钮可实现多选,选中时边框为红色

     如下图

    实现和出现的问题:

    使用xib实现,select时 颜色变为蓝色,怎么移除这个蓝色呢?

    这里有两种方法修复此问题:

    1.使用代码:改变选中时的背景颜色(默认为蓝)和字体颜色(默认为白)

    sender.tintColor = [UIColor clearColor];

     [sender  setTitleColor:[UIColor blackColor]  forState:UIControlStateSelected];

    2.xib中直接设置改变位置如下图所示

    完美的解决问题:

    相关文章

      网友评论

          本文标题:iOS 使用xib生成button,使用select属性时背景颜

          本文链接:https://www.haomeiwen.com/subject/vkkfpftx.html