NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

How to make a UIImageView round on all screen sizes

Forums > iOS

Hello!

I am trying to make a UIImageView round on all screen sizes. On the iPhone 11 simulator, the image view is round as expected. However, on all other iPhone simulators, the image view has a diamond shape. I have tried multiple solutions from posts on this and other forums, but none of them worked for me. Here is the code I am using to style the image view:

// The image view is declared as an @IBOutlet property
imageView.layer.borderWidth = 2
imageView.layer.borderColor = UIColor.black.cgColor
imageView.layer.cornerRadius = imageView.frame.size.height / 2
imageView.clipsToBounds = true

Just so you can see what it looks like on the iPhone 11 simulator, here is an image:

And on the iPhone 11 Pro simulator, it looks like this:

Any help with this is greatly appreciated.

Thanks,

Nathan

   

Hi, As we are also facing the same issue. As our image view of welding helmet round in iPhone 11 and iPhone 6 simulator. But in other simulators is pyramidical shape. Our developers are working on it since May. But still they haven't found the detectable issue so they could fix it.

   

Hi, Since we are also having same problem. In the X plane 11 vs microsoft flight simulator 2020, the circular is shown as in our photograph. However, the shape of some simulators is pyramidal. Since May, our developers have been working on it. They still haven't identified the fixable problem, though.

   

Hacking with Swift is sponsored by Judo

SPONSORED Let’s face it, SwiftUI previews are limited, slow, and painful. Judo takes a different approach to building visually—think Interface Builder for SwiftUI. Build your interface in a completely visual canvas, then drag and drop into your Xcode project and wire up button clicks to custom code. Download the Mac App and start your free trial today!

Try now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.