From 6bfb626f7bebcc37e661329946277c23457f2001 Mon Sep 17 00:00:00 2001 From: codingfish <1430263750@qq.com> Date: Mon, 29 Jul 2019 17:37:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCLAlertView/SCLAlertView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index e148a2a..14ee95e 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -24,7 +24,7 @@ #define KEYBOARD_HEIGHT 80 #define PREDICTION_BAR_HEIGHT 40 #define ADD_BUTTON_PADDING 10.0f -#define DEFAULT_WINDOW_WIDTH 240 +#define DEFAULT_WINDOW_WIDTH 270 @interface SCLAlertView () From 7ff3471359f336521532583e6f95ad48f06bb4a0 Mon Sep 17 00:00:00 2001 From: codingfish <1430263750@qq.com> Date: Mon, 29 Jul 2019 17:52:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=20UI=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCLAlertView/SCLAlertView.m | 23 ++++++++++++----------- SCLAlertView/SCLButton.m | 7 ++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 14ee95e..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 270 +#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); }