In Xcode 6 we have a new feature called adaptive layout. By using that I have created a new project in which it I need to have different font size based on the layout.
In iPhone 3.5 inch screen I must have font size as 17pt, and other screen size in iPhone must be 21pt.
Can anyone tell me how I can achieve this using adaptive layout?
To change the font or the size of a UILabel in a Storyboard or . XIB file, open it in the interface builder. Select the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.
In Interface Builder, select the text style from the Font menu, then select the Automatically Adjust Font checkbox to the right of Dynamic Type.
February 11, 2021. The Dynamic Type feature allows users to choose the size of textual content displayed on the screen. It helps users who need larger text for better readability. It also accommodates those who can read smaller text, allowing more information to appear on the screen.
Yes, you can do with storyboad. There is a + sign on the left of the font, click it and select the size class and choose the font size needed
In viewDidAppear or viewWillAppear, you can detect the size of the layout. You only have to update font size based on the detected size.
You can use [[UIScreen mainScreen] bounds];
or in iOS8 : [[UIScreen mainScreen] nativeBounds];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With