Reputation: 245
Size classes :
compact width any height for all compact width layout (all phones except iPhone 6 plus)
compact width regular height for all iphone in potrait
any width compact height for all iphone in landscape (except iphone 6 plus)
regular width compact height (for iPhone 6 plus) iphone 6 plus in landscape
Now i have label and i change the font size for iPhone 6 and iPhone 6 plus e.g for "compact width any height" its "12" and for "compact width regular height" its "15" in portrait . the size is 15 for all iPhones in portrait.
But it is all right in landscape when i change the font size of "any width compact height" to "12" and "regular width compact height" to "15" its working fine .
My Question is that how should i do the same for portrait ???
Upvotes: 4
Views: 419
Reputation: 245
[self setFont:[UIFont fontWithName:@"HelveticaNeueLTStd-Lt" size:49.0]];
Set the font size now i calculate the size with respect to ratio .
As we know iPhone 5 is 85.3 % smaller than iPhone 6 so after some research...
if (IS_IPHONE_6)
[self setFont:[UIFont fontWithName:self.font.fontName size:(self.font.pointSize)*1.18]];
else if (IS_IPHONE_5)
{
[self setFont:[UIFont fontWithName:self.font.fontName size:(self.font.pointSize)]];
}
else
{
[self setFont:[UIFont fontWithName:self.font.fontName size:(self.font.pointSize)*1.3]];
}
This will solve my problem ......
Upvotes: 6
Reputation:
It sounds like you're trying to set up requirements for each orientation. However, the UI adapts to a size class, not to an orientation.
Don't think of size classes in terms of orientation.
Try this:
This should use 12 if it is Compact|Compact, Regular|Compact, or Compact|Regular, and 15 otherwise.
Upvotes: 3