0

当我收到来自 DB 的新更新时,我想在选项卡中添加一个徽章。有没有一种方法可以调用来更新IndicatorInfo

无法弄清楚请帮助。

4

1 回答 1

1

我不得不使用 XIB 文件,并手动设置约束和处理案例。

执行的步骤

  1. UIImageViewButtonCell.xib文件中添加约束以在UILabel. (我将它们添加到 aUIView以确保视图居中。)
  2. 更改为以下代码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
        })
    
  3. 添加约束@IBOutlet并将其constant值设置0.0为不应该存在图像的时间。
于 2017-10-24T07:41:23.893 回答