【问题标题】:Setting corner radius without clipsToBounds works only for UIView type?设置不带 clipsToBounds 的角半径仅适用于 UIView 类型?
【发布时间】:2020-04-24 18:01:21
【问题描述】:

我有一个 UIView,我单独为其设置了一个cornerRadius 属性。 UIView 更新它的角。但是假设我有一个 UILabel,我为它单独设置了没有 clipsToBounds 的cornerRadius 属性,它不起作用。都是UIView类型的,那为什么UILabel不行呢

【问题讨论】:

    标签: ios uiview label layer cornerradius


    【解决方案1】:

    在内部UILabel 有多个...UIView 没有。

    你可以使用:

    myLabel.clipsToBounds = true
    

    myLabel.layer.masksToBounds = true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-01
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-18
      相关资源
      最近更新 更多