Skip to content

Commit

Permalink
优化ActionSheet内部结构
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiang1994 committed Sep 1, 2020
1 parent bb97b0a commit 6c3468e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Framework/LEEAlert/LEEAlert.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.alert;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -325,7 +325,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.lee.alert;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion LEEAlert.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LEEAlert"
s.version = "1.4.0"
s.version = "1.4.1"
s.summary = "优雅的Alert ActionSheet"

s.homepage = "https://github.com/lixiang1994/LEEAlert"
Expand Down
4 changes: 2 additions & 2 deletions LEEAlert/LEEAlert.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @brief LEEAlert
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.4.0
* @copyright Copyright © 2016 - 2020年 lee. All rights reserved.
* @version V1.4.1
*/

#import <Foundation/Foundation.h>
Expand Down
36 changes: 22 additions & 14 deletions LEEAlert/LEEAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @brief LEEAlert
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.4.0
* @copyright Copyright © 2016 - 2020年 lee. All rights reserved.
* @version V1.4.1
*/

#import "LEEAlert.h"
Expand Down Expand Up @@ -3025,8 +3025,6 @@ - (void)updateActionSheetLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFl

actionSheetViewFrame.size.height = actionSheetViewHeight > actionSheetViewMaxHeight - cancelActionTotalHeight ? actionSheetViewMaxHeight - cancelActionTotalHeight : actionSheetViewHeight;

actionSheetViewFrame.origin.x = (viewWidth - actionSheetViewMaxWidth) * 0.5f;

self.actionSheetView.frame = actionSheetViewFrame;

[self.actionSheetView layoutIfNeeded];
Expand Down Expand Up @@ -3058,11 +3056,11 @@ - (void)updateActionSheetLayoutWithViewWidth:(CGFloat)viewWidth ViewHeight:(CGFl

CGRect containerFrame = self.containerView.frame;

containerFrame.size.width = viewWidth;
containerFrame.size.width = actionSheetViewMaxWidth;

containerFrame.size.height = actionSheetViewFrame.size.height + cancelActionTotalHeight + VIEWSAFEAREAINSETS(self.view).bottom + self.config.modelActionSheetBottomMargin;

containerFrame.origin.x = 0;
containerFrame.origin.x = (viewWidth - actionSheetViewMaxWidth) * 0.5f;

if (isShowed) {

Expand All @@ -3080,21 +3078,31 @@ - (void)configActionSheet{

__weak typeof(self) weakSelf = self;

_containerView = [UIView new];
UIView *shadowView = [UIView new];

[self.view addSubview: _containerView];
shadowView.frame = self.view.bounds;

[self.containerView addSubview: self.actionSheetView];
shadowView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

self.containerView.backgroundColor = self.config.modelActionSheetBackgroundColor;
shadowView.backgroundColor = [UIColor clearColor];

self.containerView.layer.shadowOffset = self.config.modelShadowOffset;
shadowView.layer.shadowOffset = self.config.modelShadowOffset;

self.containerView.layer.shadowRadius = self.config.modelShadowRadius;
shadowView.layer.shadowRadius = self.config.modelShadowRadius;

self.containerView.layer.shadowOpacity = self.config.modelShadowOpacity;
shadowView.layer.shadowOpacity = self.config.modelShadowOpacity;

self.containerView.layer.shadowColor = self.config.modelShadowColor.CGColor;
shadowView.layer.shadowColor = self.config.modelShadowColor.CGColor;

[self.view addSubview: shadowView];

_containerView = [UIView new];

[shadowView addSubview: _containerView];

[self.containerView addSubview: self.actionSheetView];

self.containerView.backgroundColor = self.config.modelActionSheetBackgroundColor;

self.actionSheetView.scrollEnabled = self.config.modelIsScrollEnabled;

Expand Down
4 changes: 2 additions & 2 deletions LEEAlert/LEEAlertHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @brief LEEAlertHelper
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.4.0
* @copyright Copyright © 2016 - 2020年 lee. All rights reserved.
* @version V1.4.1
*/

#ifndef LEEAlertHelper_h
Expand Down
1 change: 1 addition & 0 deletions LEEAlertDemo/LEEAlertDemo/ActionSheetTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ - (void)demo:(NSInteger)index{
.LeeActionSheetBottomMargin(0.0f)
.LeeActionSheetBackgroundColor([UIColor whiteColor])
.LeeCornerRadius(0.0f)
.LeeActionSheetHeaderCornerRadii(CornerRadiiMake(0, 0, 0, 0))
.LeeConfigMaxWidth(^CGFloat(LEEScreenOrientationType type) {

// 这是最大宽度为屏幕宽度 (横屏和竖屏)
Expand Down

0 comments on commit 6c3468e

Please sign in to comment.