UIlabel layer.cornerRadius not working in iOS 7.1

后端 未结 8 1902
时光说笑
时光说笑 2021-01-30 04:40

I\'m currently looking at a UILabel with the property addMessageLabel.layer.cornerRadius = 5.0f; On a device with iOS 7.0 installed, it has rounded corners. On a de

8条回答
  •  情歌与酒
    2021-01-30 05:09

    Try the followings,

    [[addMessageLabel layer] setCornerRadius:5.0f];
    [[addMessageLabel layer] setMasksToBounds:YES];
    
    //or
    [addMessageLabel setClipsToBounds:YES];
    

    Swift

    addMessageLable.layer.cornerRadius = 5.0
    addMessageLable.layer.masksToBounds = true
    
    //or
    addMessageLable.layer.clipsToBounds = true
    

提交回复
热议问题