tom1991te tom1991te - 4 years ago 109
iOS Question

Different storyboard for iPhone 7 and 7 plus

I have a circle in the middle which we called a bubble.
Now when I change in the storyboard the view as to iPhone 7 it looks like this:
iPhone7 in iPhone7 view

But when I change it to view as iPhone 7 Plus it looks like this

iPhone7 in iPhone7 plus view

The circle is not circular anymore. How is that possible when I didn't change anything else but the view as? Does this view as actually update the storyboard?

To make the circle I use the following line of code:

self.bubble?.layer.cornerRadius = (self.bubble?.frame.height)! / 2


If yes does apple select the storyboard based on the iPhone I install my app on?

Answer Source

Maybe the view width is not equal to its height.

Add an aspect ratio constraint between view width and height.

Or

You can set a fixed width and height constraint as @User511 mentioned. Whatever, that suits you.

Also, you could be setting the cornerRadius before the view takes its final shape. Try to move the following to viewWillAppear or to viewDidLayoutSubviews method:

self.bubble?.layer.cornerRadius = (self.bubble?.frame.height)! / 2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download