在图标和标题之间设置 DLRadioButton marginWidth
Set DLRadioButton marginWidth between icon and title
在我升级到 Swift 4.2 - Xcode 10.1 之前,我使用的 DLRadioButton
在 icon
和 title
之间有均匀的间距。我从不设置间距,一切正常。升级后 icon
和 title
重叠
cocoapod for it 表示它使用 kdefaultmarginwidth
的默认 marginWidth
我尝试将代码中的 marginWidth
设置为任何肯定会像 50.0
这样增加间距的东西,但重叠仍然存在。我在某处读到 kdefaultmarginwidth
间距是 5.0
如何调整间距?
代码:
let saleButton: DLRadioButton = {
let button = DLRadioButton(type: .custom)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Sale", for: .normal)
button.setTitleColor(UIColor.lightGray, for: .normal)
button.marginWidth = 50.0 // I tried 5.0, 10.0, 20.0, even 100.0 but nothing
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(saleButton)
// constraints get set
}
在我升级到 Swift 4.2 - Xcode 10.1 之前,我使用的 DLRadioButton
在 icon
和 title
之间有均匀的间距。我从不设置间距,一切正常。升级后 icon
和 title
重叠
cocoapod for it 表示它使用 kdefaultmarginwidth
marginWidth
我尝试将代码中的 marginWidth
设置为任何肯定会像 50.0
这样增加间距的东西,但重叠仍然存在。我在某处读到 kdefaultmarginwidth
间距是 5.0
如何调整间距?
代码:
let saleButton: DLRadioButton = {
let button = DLRadioButton(type: .custom)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Sale", for: .normal)
button.setTitleColor(UIColor.lightGray, for: .normal)
button.marginWidth = 50.0 // I tried 5.0, 10.0, 20.0, even 100.0 but nothing
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(saleButton)
// constraints get set
}