UIlabel layer.cornerRadius not working in iOS 7.1

后端 未结 8 1976
时光说笑
时光说笑 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: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
    
            }
    

提交回复
热议问题