I want my button to have a size of 30x35 on iPhone and 60x70 on iPad. I create the button in a storyboard. I know what I need to use size classes. But I can't create different sizes on different devices. I use this sequence of actions:
Select iPad Pro 9,7 in storyboard.
Create button and change width 60, height 70.
Create width and aspects ratio constraints.
In width constraint unmark Installed
press plus and create wR hR Installed
.
Select iPhone 8 in storyboard.
Change width 30, height 35.
Create width constraints.
Sometimes I create different sizes on iPhone and iPad but sometimes this doesn't work.
Is this the right sequence of actions or not?
Update
Please tell me if I'm not right. For my button in iPad (60x70) I should create width constraint and press "installed" wR hR. For my button in iPhone (30x35) I should create one more width constraint and press "installed" for wC hC, wR hC, wC hR?
If you just want to vary the width for iphone and ipad, JUST apply size class to your UIButton.
Go to attributes inspector
of your button and click plus button to the left of width property.
Selected Width: Regular and Height: Regular. and tap on button Add Variation
Now, i my case, width will be 200
for IPhone and 400
for IPad
Note. You don't need to click on installed
property even single time.
Do let me know if you need any help