Better way to adjust size

This commit is contained in:
dayanch96 2023-07-18 06:30:13 +03:00
parent 7170d2681f
commit 4789166a33

View file

@ -20,21 +20,14 @@ static inline NSString *LOC(NSString *key) {
return [tweakBundle localizedStringForKey:key value:nil table:nil];
}
@interface PKYStepper : UIControl
@end
// Fit speed controllers localized 'Normal' text into frame
%hook PKYStepper
- (void)layoutSubviews {
%orig;
for (UIView *subview in self.subviews) {
if ([subview isKindOfClass:[UILabel class]]) {
UILabel *label = (UILabel *)subview;
label.adjustsFontSizeToFitWidth = YES;
label.minimumScaleFactor = 0.5;
}
}
- (instancetype)initWithFrame:(CGRect)frame {
self = %orig;
if (self) {
UILabel *countLabel = [self valueForKey:@"countLabel"];
countLabel.adjustsFontSizeToFitWidth = YES;
} return self;
}
%end