【发布时间】:2021-11-21 18:47:52
【问题描述】:
更新到 xcode 13 / ios 15 后。我明白了,UIButton 上的文本总是被截断,大小不固定。文本从 PushRelay (RxSwift) 传递。
See UIButton's on a horizontal UIStackView.
代码如下
let tagButton = UIButton()
addSubview(tagButton)
tagButton.layer.cornerRadius = 16
tagButton.layer.masksToBounds = true
tagButton.titleEdgeInsets = UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)
tagButton.snp.makeConstraints({
$0.edges.equalToSuperview()
})
文本提供者:
bag.insert(
viewModel.outputs.titleAttrText
.drive(tagButton.rx.attributedTitle(for: .normal))
)
【问题讨论】:
标签: uibutton rx-swift truncated ios15