Resize in portrait mode for iPhone 6 and iPhone 6 plus

Class Types:

compact width of any height for all compact width layouts (all phones except iPhone 6 plus)

compact width correct height for all iphone in potrait

any width of compact height for all iphone in the landscape (except iphone 6 plus)

normal width compact height (for iPhone 6 plus) iphone 6 plus in landscape

Now I have a shortcut and I change the font size for iPhone 6 and iPhone 6 plus, for example, for "compact width of any height", its "12" and for "compact width of normal height" - "15" in the portrait. The size is 15 for all iPhones in the portrait .

But in the landscape, everything is fine when I change the font size "any width of compact height" to "12" and "normal width of compact height" to "15", it works fine.

My question is how should I do the same for a portrait ???

+4
source share
2 answers
[self setFont:[UIFont fontWithName:@"HelveticaNeueLTStd-Lt" size:49.0]];

Set the font size, now I am calculating the size relative to the ratio.

As we know, the iPhone 5 is 85.3% smaller than the 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 ......

+6
source

It looks like you are trying to customize the requirements for each orientation. However, the user interface adapts to the size class, not the orientation.

Do not think about size classes in terms of orientation.

Try the following:

  • wAny hAny: 15
  • wAny hCompact: 12
  • wCompact hAny: 12

12, Compact Compact, Regular | Compact Compact | Regular 15 .

+3

Source: https://habr.com/ru/post/1589397/


All Articles