From 7defffe08fc75a5421861eac4ac5631b81a92d86 Mon Sep 17 00:00:00 2001 From: Grigory Lutkov Date: Fri, 13 Nov 2015 17:27:30 +0300 Subject: [PATCH] Refactoring --- .../TableViewControllerCustomActionSheet.m | 8 ++++---- LGAlertView.podspec | 2 +- LGAlertView/LGAlertView.h | 2 +- LGAlertView/LGAlertView.m | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Demo/LGAlertViewDemo/TableViewControllerCustomActionSheet.m b/Demo/LGAlertViewDemo/TableViewControllerCustomActionSheet.m index 570e9f0..11e3f77 100644 --- a/Demo/LGAlertViewDemo/TableViewControllerCustomActionSheet.m +++ b/Demo/LGAlertViewDemo/TableViewControllerCustomActionSheet.m @@ -156,7 +156,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath alertView.messageTextColor = [UIColor blackColor]; alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height); alertView.offsetVertical = 0.f; - alertView.cancelButtonOffset = 0.f; + alertView.cancelButtonOffsetY = 0.f; [alertView showAnimated:YES completionHandler:nil]; } else if (indexPath.row == 5) @@ -184,7 +184,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath alertView.messageTextColor = [UIColor blackColor]; alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height); alertView.offsetVertical = 0.f; - alertView.cancelButtonOffset = 0.f; + alertView.cancelButtonOffsetY = 0.f; alertView.titleTextAlignment = NSTextAlignmentLeft; alertView.messageTextAlignment = NSTextAlignmentLeft; alertView.buttonsTextAlignment = NSTextAlignmentRight; @@ -217,7 +217,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath alertView.messageTextColor = [UIColor blackColor]; alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height); alertView.offsetVertical = 0.f; - alertView.cancelButtonOffset = 0.f; + alertView.cancelButtonOffsetY = 0.f; alertView.titleTextAlignment = NSTextAlignmentLeft; alertView.messageTextAlignment = NSTextAlignmentLeft; alertView.destructiveButtonTextAlignment = NSTextAlignmentRight; @@ -251,7 +251,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath alertView.messageTextColor = [UIColor blackColor]; alertView.width = MIN(self.view.bounds.size.width, self.view.bounds.size.height); alertView.offsetVertical = 0.f; - alertView.cancelButtonOffset = 0.f; + alertView.cancelButtonOffsetY = 0.f; alertView.titleTextAlignment = NSTextAlignmentLeft; alertView.messageTextAlignment = NSTextAlignmentLeft; alertView.destructiveButtonTextAlignment = NSTextAlignmentRight; diff --git a/LGAlertView.podspec b/LGAlertView.podspec index c525e15..ab67735 100644 --- a/LGAlertView.podspec +++ b/LGAlertView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'LGAlertView' - s.version = '2.0.8' + s.version = '2.0.9' s.platform = :ios, '6.0' s.license = 'MIT' s.homepage = 'https://github.com/Friend-LGA/LGAlertView' diff --git a/LGAlertView/LGAlertView.h b/LGAlertView/LGAlertView.h index d59365e..17a7a81 100644 --- a/LGAlertView/LGAlertView.h +++ b/LGAlertView/LGAlertView.h @@ -86,7 +86,7 @@ typedef NS_ENUM(NSUInteger, LGAlertViewWindowLevel) /** Top and bottom offsets from borders of the screen */ @property (assign, nonatomic) CGFloat offsetVertical; /** Offset between cancel button and main view when style is LGAlertViewStyleActionSheet. Default is 8.f */ -@property (assign, nonatomic) CGFloat cancelButtonOffset; +@property (assign, nonatomic) CGFloat cancelButtonOffsetY; @property (assign, nonatomic) CGFloat heightMax; @property (assign, nonatomic) CGFloat width; diff --git a/LGAlertView/LGAlertView.m b/LGAlertView/LGAlertView.m index 747d630..30da89c 100644 --- a/LGAlertView/LGAlertView.m +++ b/LGAlertView/LGAlertView.m @@ -43,7 +43,7 @@ #define kLGAlertViewWidthStyleAlert (320.f - 20*2) #define kLGAlertViewWidthStyleActionSheet (320.f - 16*2) #define kLGAlertViewInnerMarginH (_style == LGAlertViewStyleAlert ? 16.f : 12.f) -#define kLGAlertViewIsCancelButtonSeparate(alertView) (alertView.style == LGAlertViewStyleActionSheet && alertView.cancelButtonOffset > 0.f && !kLGAlertViewPadAndNotForce(alertView)) +#define kLGAlertViewIsCancelButtonSeparate(alertView) (alertView.style == LGAlertViewStyleActionSheet && alertView.cancelButtonOffsetY > 0.f && !kLGAlertViewPadAndNotForce(alertView)) #define kLGAlertViewButtonWidthMin 64.f #define kLGAlertViewWindowPrevious(index) (index > 0 && index < kLGAlertViewWindowsArray.count ? [kLGAlertViewWindowsArray objectAtIndex:(index-1)] : nil) #define kLGAlertViewWindowNext(index) (kLGAlertViewWindowsArray.count > index+1 ? [kLGAlertViewWindowsArray objectAtIndex:(index+1)] : nil) @@ -848,7 +848,7 @@ - (void)setupDefaults _buttonsHeight = (([UIDevice currentDevice].systemVersion.floatValue < 9.0 || _style == LGAlertViewStyleAlert) ? 44.f : 56.f); _textFieldsHeight = 44.f; _offsetVertical = -1; - _cancelButtonOffset = kLGAlertViewOffsetHorizontal; + _cancelButtonOffsetY = kLGAlertViewOffsetHorizontal; _heightMax = -1.f; _width = -1.f; @@ -2583,7 +2583,7 @@ - (void)layoutInvalidateWithSize:(CGSize)size heightMax = _heightMax; if (kLGAlertViewIsCancelButtonSeparate(self) && _cancelButton) - heightMax -= (_buttonsHeight+_cancelButtonOffset); + heightMax -= (_buttonsHeight+_cancelButtonOffsetY); else if (_cancelOnTouch && !_cancelButtonTitle.length && size.width < width+_buttonsHeight*2) @@ -2616,7 +2616,7 @@ - (void)layoutInvalidateWithSize:(CGSize)size { CGFloat bottomShift = kLGAlertViewOffsetVertical; if (kLGAlertViewIsCancelButtonSeparate(self) && _cancelButton) - bottomShift += _buttonsHeight+_cancelButtonOffset; + bottomShift += _buttonsHeight+_cancelButtonOffsetY; scrollViewFrame = CGRectMake(size.width/2-width/2, size.height-bottomShift-heightMax, width, heightMax); } @@ -2627,7 +2627,7 @@ - (void)layoutInvalidateWithSize:(CGSize)size { CGRect cancelButtonFrame = CGRectZero; if (kLGAlertViewIsCancelButtonSeparate(self) && _cancelButton) - cancelButtonFrame = CGRectMake(size.width/2-width/2, size.height-_cancelButtonOffset-_buttonsHeight, width, _buttonsHeight); + cancelButtonFrame = CGRectMake(size.width/2-width/2, size.height-_cancelButtonOffsetY-_buttonsHeight, width, _buttonsHeight); _scrollViewCenterShowed = CGPointMake(scrollViewFrame.origin.x+scrollViewFrame.size.width/2, scrollViewFrame.origin.y+scrollViewFrame.size.height/2); _cancelButtonCenterShowed = CGPointMake(cancelButtonFrame.origin.x+cancelButtonFrame.size.width/2, cancelButtonFrame.origin.y+cancelButtonFrame.size.height/2); @@ -2636,7 +2636,7 @@ - (void)layoutInvalidateWithSize:(CGSize)size CGFloat commonHeight = scrollViewFrame.size.height+kLGAlertViewOffsetVertical; if (kLGAlertViewIsCancelButtonSeparate(self) && _cancelButton) - commonHeight += _buttonsHeight+_cancelButtonOffset; + commonHeight += _buttonsHeight+_cancelButtonOffsetY; _scrollViewCenterHidden = CGPointMake(scrollViewFrame.origin.x+scrollViewFrame.size.width/2, scrollViewFrame.origin.y+scrollViewFrame.size.height/2+commonHeight+_layerBorderWidth+_layerShadowRadius); _cancelButtonCenterHidden = CGPointMake(cancelButtonFrame.origin.x+cancelButtonFrame.size.width/2, cancelButtonFrame.origin.y+cancelButtonFrame.size.height/2+commonHeight);