Skip to content

Commit

Permalink
Set the label text alignment with Center / Fix iOS6 crash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
devSC committed Aug 20, 2015
1 parent 5a7e4ea commit d902d11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 3 additions & 8 deletions Demo/WSProgressHUD/WSProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -1043,13 +1043,8 @@ - (instancetype)initWithFrame:(CGRect)frame
UIImage *successImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"success@2x" ofType:@"png"]];
UIImage *failurImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"error@2x" ofType:@"png"]];

if ([[UIImage class] instancesRespondToSelector:@selector(imageWithRenderingMode:)]) {
WSProgressHUDSuccessImage = [successImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
WSProgressHUDErrorImage = [failurImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
} else {
WSProgressHUDErrorImage = failurImage;
WSProgressHUDSuccessImage = successImage;
}
WSProgressHUDSuccessImage = [self image:successImage withTintColor:WSProgressHUDForeGroundColor];
WSProgressHUDErrorImage = [self image:failurImage withTintColor:WSProgressHUDForeGroundColor];

[self addSubview:self.hudView];

Expand Down Expand Up @@ -1104,7 +1099,7 @@ - (UILabel *)labelView
}
_labelView.adjustsFontSizeToFitWidth = YES;
_labelView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_labelView.textAlignment = NSTextAlignmentLeft;
_labelView.textAlignment = NSTextAlignmentCenter;
_labelView.numberOfLines = 0;
}
return _labelView;
Expand Down
11 changes: 3 additions & 8 deletions WSProgressHUD/WSProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -1043,13 +1043,8 @@ - (instancetype)initWithFrame:(CGRect)frame
UIImage *successImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"success@2x" ofType:@"png"]];
UIImage *failurImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"error@2x" ofType:@"png"]];

if ([[UIImage class] instancesRespondToSelector:@selector(imageWithRenderingMode:)]) {
WSProgressHUDSuccessImage = [successImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
WSProgressHUDErrorImage = [failurImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
} else {
WSProgressHUDErrorImage = failurImage;
WSProgressHUDSuccessImage = successImage;
}
WSProgressHUDSuccessImage = [self image:successImage withTintColor:WSProgressHUDForeGroundColor];
WSProgressHUDErrorImage = [self image:failurImage withTintColor:WSProgressHUDForeGroundColor];

[self addSubview:self.hudView];

Expand Down Expand Up @@ -1104,7 +1099,7 @@ - (UILabel *)labelView
}
_labelView.adjustsFontSizeToFitWidth = YES;
_labelView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_labelView.textAlignment = NSTextAlignmentLeft;
_labelView.textAlignment = NSTextAlignmentCenter;
_labelView.numberOfLines = 0;
}
return _labelView;
Expand Down

0 comments on commit d902d11

Please sign in to comment.