为什么在滚动 tableview 后设置 UILabel 的边框?

Why border of UILabel is setting after scrolling the tableview?

我有 table view.In 这个 table 视图 我有一个自定义 cell.In 单元格 我有一个标签,在 [=17= 处有一个圆圈] 我已经写了一些代码所以让它变成圆圈但是当 table 视图加载时它不显示圆圈 first.When 我滚动 table 视图然后它在 UILabel 周围显示圆圈。

我正在使用下面的代码。

  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cellId="NotificationCell"
    let cell:NotificationCell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! NotificationCell

    cell.label_taskCount.layer.cornerRadius =  cell.label_taskCount.frame.size.height/2
    cell.label_taskCount.layer.borderWidth = 1
    cell.label_taskCount.layer.borderColor = UIColor.white.cgColor
    cell.label_taskCount.layoutIfNeeded()
    cell.label_taskCount.text = String(indexPath.row)

    return cell
  }

尝试在 NotificationCell

中设置 layoutSubViews 中的圆角半径
override func layoutSubviews() {
    super.layoutSubviews()
    self.label_taskCount.layer.cornerRadius = self.label_taskCount.frame.size.height/2
    self.label_taskCount.layer.borderWidth = 1
    self.label_taskCount.layer.borderColor = UIColor.white.cgColor
}