Reputation: 3984
I'm working with Swift, IOS 8 and AutoLayout. I have a big label, size 40 on center of the screen.
I want that on iPhone 5s- the size of label becomes like 34, and on iPad a bigger font size, like 50.
How can I do this with AutoLayout?
Upvotes: 4
Views: 9310
Reputation: 123
Step 1 : Select UILabel and Click on plus icon in Attribute Inspector
Step 2 : To add font size for new device let suppose Iphone Portrait, hover on Compact Width -> Any Height.
Step 3 : Now change this new font to 25 i.e for iphone. And on the Font above it to be 70 which is now for devices other than iphone portrait.
Step 4 : Output on iphone6 vs Ipad Retina
Upvotes: 1
Reputation: 9042
You can set a minimum font size as well as the maximum font size you want on the label, then apply constraints on the edges and let the intrinsic content size of text determine the size of the label.
Upvotes: 0
Reputation: 3984
I found a solution: Just go to your storyboard, click on your label and then click on "+" on the left of "Font" (Attributes Inspector) and add another font with a different size:
On my case, I added for iPad a size of 50. Worked perfectly!
Upvotes: 16