I have a UICollectionView in a ViewController of type ANY-ANY storyboard and using auto-layout with swift. I have changed the size of ViewController to iPhone 5 screen size.

The problem is that, there is a button inside the UICollectionViewCell and I am trying to make that circular. When I run in iPhone 5 the button gets in circular fine, But if I run in iPhone 6 or 6+ it doesn't come in circular.

Below is the code i am using in "cellForItemAtIndexPath"

```
    var btnImage = cell.contentView.viewWithTag(100) as UIButton
    btnImage.layer.masksToBounds = true
    btnImage.layer.cornerRadius = btnImage.frame.size.height/2

```

The result of this code is as below 
[![enter image description here](https://i.stack.imgur.com/5fn5b.png)](https://i.stack.imgur.com/5fn5b.png)

And if I use below code 

```
    var btnImage = cell.contentView.viewWithTag(100) as UIButton
    btnImage.layoutIfNeeded()
    btnImage.layer.masksToBounds = true
    btnImage.layer.cornerRadius = btnImage.frame.size.height/2

```

The result is as below

[![enter image description here](https://i.stack.imgur.com/RHiso.png)](https://i.stack.imgur.com/RHiso.png)

Does anyone have any Idea about this issue.
Thanks in advance.