当我收到来自 DB 的新更新时,我想在选项卡中添加一个徽章。有没有一种方法可以调用来更新IndicatorInfo
?
无法弄清楚请帮助。
我不得不使用 XIB 文件,并手动设置约束和处理案例。
UIImageView
在ButtonCell.xib
文件中添加约束以在UILabel
. (我将它们添加到 aUIView
以确保视图居中。)更改为以下代码ButtonBaragerTabStripViewController
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width: { [weak self] (childItemInfo) -> CGFloat in
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.font = self?.settings.style.buttonBarItemFont
label.text = childItemInfo.title
let labelSize = label.intrinsicContentSize
return labelSize.width + (childItemInfo.image != nil ? 35.0 : 0.0) + (self?.settings.style.buttonBarItemLeftRightMargin ?? 8) * 2
})
@IBOutlet
并将其constant
值设置0.0
为不应该存在图像的时间。