相关疑难解决方法(0)

Segment Control 的 SelectedTintColor 在 iOS 13 上不是圆角

圆角在 iOS 12 及更低版本上运行良好,但在 iOS 13 上已损坏。我创建了一个自定义 Segment 控件类。

代码:

class SegmentedControl: UISegmentedControl {
    override func layoutSubviews() {
      super.layoutSubviews()
      layer.cornerRadius = self.bounds.size.height / 2.0
      layer.borderColor = UIColor(red: 170.0/255.0, green: 170.0/255.0, blue: 170.0/255.0, alpha: 1.0).cgColor
      layer.borderWidth = 1.0
      layer.masksToBounds = true
      clipsToBounds = true

   }
}
Run Code Online (Sandbox Code Playgroud)

我已经阅读了这篇文章 -如何在 iOS 13 的 UISegmentedControl 中更改段的颜色? 但我找不到任何解决方案。

截屏: 在此处输入图片说明

uisegmentedcontrol ios swift4 ios13

7
推荐指数
2
解决办法
4854
查看次数

标签 统计

ios ×1

ios13 ×1

swift4 ×1

uisegmentedcontrol ×1