UIlabel layer.cornerRadius not working in iOS 7.1

后端 未结 8 1881
时光说笑
时光说笑 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:31
    yourlabelname.layer.cornerRadius = yourlabelname.frame.size.width/2;
    [yourlabelname setClipsToBounds:YES];
    

    Make sure you are checking with appropriate Deployment target.

    0 讨论(0)
  • 2021-01-30 05:33
     //works perfect in Swift 2.0 for a circular or round image          
    
    
    @IBOutlet var theImage: UIImageView!
            override func viewDidLoad() {
                super.viewDidLoad()
        //Make sure the width and height are same
                self.theImage.layer.cornerRadius = self.theImage.frame.size.width / 2
                self.theImage.layer.borderWidth = 2.0
                self.theImage.layer.borderColor = UIColor.whiteColor().CGColor
                self.theImage.clipsToBounds = true
    
            }
    
    0 讨论(0)
提交回复
热议问题