你好,我想把UIButton
标题标签做成一个圆圈。所以我这样做了。UIButton titleLabel作为圆圈
btnAttachments.setTitle(strcount, for: .normal)
btnAttachments.setTitleColor(UIColor.white, for: .normal)
btnAttachments.titleLabel?.backgroundColor=com.getRedcolor()
btnAttachments.titleLabel?.font=UIFont.init(name: "Bariol", size: 15)
btnAttachments.titleLabel?.layer.cornerRadius=(btnAttachments.titleLabel?.frame.width)!/2
但它并没有使它成为一个圆圈。它看起来像这样的代码doen't在titleLabel
UPDATE影响
请帮我 感谢
我想你忘记了btnAttachments.titleLabel.clipsToBounds = YES –
我没有和仍然相同: ( 这是为什么? – user1960169
我认为btnAttachments.titleLabel?.frame.width = 0.我尝试btnAttachments.titleLabel?.layer.cornerRadius = 10.它的工作 –