UILabel question


I have a question with something I encountered the other day. I had a standard prototype row with a label that was a square and had the same height as the row. I added the following code when setting the label:

 label.layer.cornerRadius = label.frame.size.width/2
 label.layer.masksToBounds = true

This made my label circular which was what I wanted. The label was a bit big in comparison to the row height and felt crammed in and the row was pretty narrow on my iphone 6 plus, so I wanted the row to be taller and set it in my storyboard to 66. Ran the app and the row was taller and looked good, but the circle label went elliptical. I’d set the label to 1:1 aspect ration and 43x43.

In the end I had to use self.tableView.rowHeight = 66.0 in viewDidLoad() for the label to become back to circular and look nice. But I don’t understand why I had to do this? Here is my SO question:

Always use the code way to resize things. Storyboard doesnt always work as expected.

Good to know! Thanks