I have simple app that has some views to show. It is portrait app so I do not have to build any other design for orientation specific.
But I have one trouble(Being new on iOS), I have read about size classes and yet I am unable to understand that How I can mange to increase size of a text/Label per device.
What I have done:
I mean I am testing on following mobiles
- iPhone 5s
- iPhone 8plus
- iPhone XR
I have a label inside a view and that label has 18 points as a text size or font size
What I want:
I want that my font must be gradually increase on large devices such as iPhone XR and iPad and decrease on smaller devices such as iPhone 5s
Question: I want to do following but I do not know how to do it even with size classes because as far as I understood Size classes is related to orientations the most, may be I am wrong but this is I extracted from my readings
I want that on following phone, text size must be something like these
- iPhone 5s --> Text Size 12
- iPhone 8Plus --> Text Size 18
- iPhone XR --> Text Size 19
- iPadPro 12 inch --> Text Size 32
Please let me know how to achieve that ?
Note: I want to do it with out coding I mean in interface builder
Size classes will not help you with this.
There are 2 ways to do this:
To solve your case . you need to identify the user device modal.
If you support the Accessibility feature in your app. Users will have a controller for text Size in your app.
Settings -> Display&brightness -> Text Size .
This default size will change for different devices based on device size.
You can button font now.
Now you knew which device users have, So you can create one custom Label (or) Button (or) AnyComponent with text data.
In your storyboard select your label, go to the right corner and select custom class and put "CustomLabel".Now you don't have to write any other code it will work perfectly.
I hope your issue is solved now.