UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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

3      

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.

3      

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.

3      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.