diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index e148a2a..b0f1f9a 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -21,10 +21,11 @@ #import #endif +#define SizeScale ([UIScreen mainScreen].bounds.size.width == 375 ? 1 : ([UIScreen mainScreen].bounds.size.width < 375 ? 0.9 : 1.1)) #define KEYBOARD_HEIGHT 80 #define PREDICTION_BAR_HEIGHT 40 #define ADD_BUTTON_PADDING 10.0f -#define DEFAULT_WINDOW_WIDTH 240 +#define DEFAULT_WINDOW_WIDTH 300*SizeScale @interface SCLAlertView () @@ -154,8 +155,8 @@ - (void)setupViewWindowWidth:(CGFloat)windowWidth { // Default values kCircleBackgroundTopPosition = -15.0f; - kCircleHeight = 56.0f; - kCircleHeightBackground = 62.0f; + kCircleHeight = 61.0f; + kCircleHeightBackground = 61.0f; kActivityIndicatorHeight = 40.0f; kTitleTop = 30.0f; self.titleHeight = 40.0f; @@ -174,12 +175,12 @@ - (void)setupViewWindowWidth:(CGFloat)windowWidth self.tintTopCircle = YES; // Font - _titleFontFamily = @"HelveticaNeue"; - _bodyTextFontFamily = @"HelveticaNeue"; - _buttonsFontFamily = @"HelveticaNeue-Bold"; - _titleFontSize = 20.0f; - _bodyFontSize = 14.0f; - _buttonsFontSize = 14.0f; + _titleFontFamily = @"FZHei-B01S"; + _bodyTextFontFamily = @"FZHei-B01S"; + _buttonsFontFamily = @"FZHei-B01S"; + _titleFontSize = 15.0f; + _bodyFontSize = 12.0f; + _buttonsFontSize = 15.0f; // Init _labelTitle = [[UILabel alloc] init]; @@ -350,13 +351,13 @@ - (void)viewWillLayoutSubviews } // Buttons - CGFloat x = 12.0f; + CGFloat x = 23*SizeScale; for (SCLButton *btn in _buttons) { btn.frame = CGRectMake(x, y, btn.frame.size.width, btn.frame.size.height); // Add horizontal or vertical offset acording on _horizontalButtons parameter if (_horizontalButtons) { - x += btn.frame.size.width + 10.0f; + x += btn.frame.size.width + 27*SizeScale; } else { y += btn.frame.size.height + 10.0f; } diff --git a/SCLAlertView/SCLButton.m b/SCLAlertView/SCLButton.m index 056ce0c..1951e74 100755 --- a/SCLAlertView/SCLButton.m +++ b/SCLAlertView/SCLButton.m @@ -9,8 +9,9 @@ #import "SCLButton.h" #import "SCLTimerDisplay.h" -#define MARGIN_BUTTON 12.0f -#define DEFAULT_WINDOW_WIDTH 240 +#define SizeScale ([UIScreen mainScreen].bounds.size.width == 375 ? 1 : ([UIScreen mainScreen].bounds.size.width < 375 ? 0.9 : 1.1)) +#define MARGIN_BUTTON 23*SizeScale +#define DEFAULT_WINDOW_WIDTH 300*SizeScale #define MIN_HEIGHT 35.0f @implementation SCLButton @@ -66,7 +67,7 @@ - (void)setupWithWindowWidth:(CGFloat)windowWidth - (void)adjustWidthWithWindowWidth:(CGFloat)windowWidth numberOfButtons:(NSUInteger)numberOfButtons { CGFloat allButtonsWidth = windowWidth - (MARGIN_BUTTON * 2); - CGFloat buttonWidth = (allButtonsWidth - ((numberOfButtons - 1) * 10)) / numberOfButtons; + CGFloat buttonWidth = (allButtonsWidth - ((numberOfButtons - 1) * 27*SizeScale)) / numberOfButtons; self.frame = CGRectMake(0.0f, 0.0f, buttonWidth, MIN_HEIGHT); }