Reputation: 1392
Hi I am new with the size class. As far I know Apple has given one size class (Compact + Regular) for Portrait iPhone 4s, 5, 6 and 6+. So How can I give different fonts size in these three different devices By storyboard or Any other way to do that. Thanks Happy coding
Upvotes: 5
Views: 839
Reputation: 2419
Autolayout
and SizeClasses
wouldn't target specific devices, so you will have to set the font sizes programatically. You can use check the size of your device using UIScreen.mainScreen().bounds.size.height
and set the size of your font accordingly. This solution will clarify you more.
Upvotes: 2
Reputation: 5612
As you mentioned in your question you need to give separate font sizes for different devices.
First thing is we cant achieve it on storyboard.
You need to assign different font sizes Manually by using If conditions & checking devices.
For ex:
if ([[UIScreen mainScreen] bounds].size.height == 568) {
// Assign Font size for iPhone 5
}else if ([[UIScreen mainScreen] bounds].size.height == 667){
// Assign Font size for iPhone 6
}else if ([[UIScreen mainScreen] bounds].size.height == 736){
// Assign Font size for iPhone 6+
}else if ([[UIScreen mainScreen] bounds].size.height == 480){
// Assign Font size for iPhone 4s
}
Note:
Upvotes: 0