Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit d50dab5

Browse files
committed
Fix the issue where instance scaling was broken if global one was enabled.
1 parent 82cf7ea commit d50dab5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

AMXFontAutoScale.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Pod::Spec.new do |s|
33

44
s.name = "AMXFontAutoScale"
5-
s.version = "1.0.1"
5+
s.version = "1.0.2"
66
s.summary = "Scale the font for UILabel and UITextView proportionally across all the screen sizes."
77

88
s.description = <<-DESC

AMXFontAutoScale/UILabel+AMXFontScale.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ - (BOOL)wasInstanceAutoScaleSet
8080

8181
+ (void)load
8282
{
83-
[self amx_swizzleInstanceSelector:@selector(willMoveToSuperview:)
84-
withSelector:@selector(swizzle_willMoveToSuperview:)];
83+
[self amx_swizzleInstanceSelector:@selector(willMoveToWindow:)
84+
withSelector:@selector(swizzle_willMoveToWindow:)];
8585
}
8686

87-
- (void)swizzle_willMoveToSuperview:(UIView *)newSuperview
87+
- (void)swizzle_willMoveToWindow:(UIWindow *)newWindow
8888
{
8989
AMXScreenSize referenceScreenSize = AMXScreenSizeCurrent;
9090
if (self.amx_autoScaleEndabled) {
@@ -97,7 +97,7 @@ - (void)swizzle_willMoveToSuperview:(UIView *)newSuperview
9797
self.font = [self.font amx_scaleForReferenceScreenSize:referenceScreenSize];
9898
}
9999

100-
[self swizzle_willMoveToSuperview:newSuperview];
100+
[self swizzle_willMoveToWindow:newWindow];
101101
}
102102

103103
@end

AMXFontAutoScaleDemo/MainViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class MainViewController: UIViewController {
1212

1313
@IBOutlet var helloLabels: [UILabel]!
1414
@IBOutlet var sizeLabels: [UILabel]!
15-
16-
override func viewDidLoad() {
17-
super.viewDidLoad()
15+
16+
override func viewDidAppear(_ animated: Bool) {
17+
super.viewDidAppear(animated)
1818

1919
if helloLabels.count == sizeLabels.count {
2020
for (index, helloLabel) in helloLabels.enumerated() {

0 commit comments

Comments
 (0)