title: Extremely weird behaviour of auto layout and CALayer
body: <p>I'm using auto layouts and custom layout for my collection view. There were a lot of auto layout warnings initially but I managed to remove all those warnings. Now the views are laid out fine but one of the subviews (a UIButton) of my collection view's cell is behaving weirdly. I have to make this button circular by setting its layer's cornerRadius based on the new frame of the button. Here's the code:</p>
  
  <p><a href="https://i.stack.imgur.com/LNHrH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LNHrH.png" alt="enter image description here"></a></p>
  
  <p>The frame of this button on storyboard is (8, 6, 52, 52). The debugger output looks something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/hk3Zg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hk3Zg.png" alt="enter image description here"></a></p>
  
  <p>You can see that the corner radius of the button's layer is being set to half the height of the button but the resulting view is not what I expect it to be.</p>
  
  <p><a href="https://i.stack.imgur.com/T6HFN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T6HFN.png" alt="enter image description here"></a></p>
  
  <p>The left grey icon is the view I'm talking about. One can see that it is not circular despite having the corner radius set to half its height.</p>
  
  <p>I have been trying and looking around for a solution for quite a while now. Any help would be appreciated.</p>
  
  <p>Thanks</p>