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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.