9

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?

Arasuvel
  • 2,971
  • 1
  • 25
  • 40
  • check this [link](https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started), you have to scroll down to Adaptive Fonts section, there is something similar to what you want. – Lucho Mar 18 '16 at 14:03

2 Answers2

4

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

Oscar Bui
  • 41
  • 1
  • 3
    Yes, that is correct. But my doubt how to achieve different font size for different iPhone screen. – Arasuvel Mar 04 '15 at 09:34
2

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];

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
  • In the latest xcode 6 we can set the font size for UILabel using attribute inspector in storyboard and I need to how should I achieve it using storyboard and also this one also helps me. – Arasuvel Oct 09 '14 at 06:46