P
P
Petrushka2015-06-04 19:54:19
Objective-C
Petrushka, 2015-06-04 19:54:19

How does the font size change in devices?

Good day, I customize the program for all devices
. I have label elements and text on the buttons, let's say they look good at 4s, it will work on 5k, but what to do with 6 and 6+, because they will be small
. I have enlarged the elements, but the text on them remains the same size! For 6+ you can change (through size classes) and even then, only in the rotated state.
What to do ?! Is it really possible to have an outlet for each element and fix the sizes in viedDidLoad? (shit code)))
Maybe the same font size is the norm?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
An, 2015-06-04
@Flanker_4

How to install font for iphone 6?

E
Elsh Yff, 2015-06-05
@Aznix

@interface AutoLabel ()
@property (nonatomic) CGFloat ff;
@property (nonatomic) BOOL isDone;
@end

@implementation AutoLabel

- (void)layoutSubviews {
    [super layoutSubviews];
    
    if (_isDone != true) {
        _ff = self.font.pointSize;
        _isDone = true;
    }
    
    CGSize sizee = [UIScreen mainScreen].bounds.size;
    CGFloat ggH = sizee.height / 568.0;
    self.font = [self.font fontWithSize:_ff*ggH];
}

@end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question