Reputation: 5844
I have one UIView
in LaunchScreen
.
I have added following constraint to this UIView
.
I want my red view always 35%
of the screen.
I have calculated the height of RedView
as : My ViewController
height is 667
I calculated the 35%
and assigned to RedView
.
I want to know that is my approach is correct. As their is very slight change in width of iPhone6Plus
and huge change in height.
Is my constraint correct for 35:65 screen.
Upvotes: 0
Views: 56
Reputation: 16820
Instead of giving Aspect ratio you could also give it a multiplier for 35%.
Step 1:
Pin RedView
from 3 sides, Right-Top-Left
Step 2:
Make RedView
and ViewController's main view to Equal height.
Step 3:
Select RedView's
equal height constraint and go to it's attribute inspector. (4th right tab)
Step 4:
Change Multiplier
value to 0.35
.
Now RedView will be always 35%
of your main screen in both Orientations.
Upvotes: 4