From 4789166a338bfb3bec47f89392c09d535701c049 Mon Sep 17 00:00:00 2001 From: dayanch96 <38832025+dayanch96@users.noreply.github.com> Date: Tue, 18 Jul 2023 06:30:13 +0300 Subject: [PATCH] Better way to adjust size --- Tweak.xm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Tweak.xm b/Tweak.xm index 71515fa..b679df3 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -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