Skip to content

Commit f1a30d2

Browse files
committed
Backward compatible fix for UITextAlignmentCenter deprecation in iOS 6.
1 parent 255de85 commit f1a30d2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

MBProgressHUD.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ typedef enum {
7474
#endif
7575
#endif
7676

77+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
78+
#define MBLabelAlignmentCenter NSTextAlignmentCenter
79+
#else
80+
#define MBLabelAlignmentCenter UITextAlignmentCenter
81+
#endif
82+
7783
#if NS_BLOCKS_AVAILABLE
7884
typedef void (^MBProgressHUDCompletionBlock)();
7985
#endif

MBProgressHUD.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ - (void)cleanUp {
426426
- (void)setupLabels {
427427
label = [[UILabel alloc] initWithFrame:self.bounds];
428428
label.adjustsFontSizeToFitWidth = NO;
429-
label.textAlignment = UITextAlignmentCenter;
429+
label.textAlignment = MBLabelAlignmentCenter;
430430
label.opaque = NO;
431431
label.backgroundColor = [UIColor clearColor];
432432
label.textColor = [UIColor whiteColor];
@@ -437,7 +437,7 @@ - (void)setupLabels {
437437
detailsLabel = [[UILabel alloc] initWithFrame:self.bounds];
438438
detailsLabel.font = self.detailsLabelFont;
439439
detailsLabel.adjustsFontSizeToFitWidth = NO;
440-
detailsLabel.textAlignment = UITextAlignmentCenter;
440+
detailsLabel.textAlignment = MBLabelAlignmentCenter;
441441
detailsLabel.opaque = NO;
442442
detailsLabel.backgroundColor = [UIColor clearColor];
443443
detailsLabel.textColor = [UIColor whiteColor];

0 commit comments

Comments
 (0)