Skip to content

Commit

Permalink
remove property actionSheetEdgeInsets
Browse files Browse the repository at this point in the history
  • Loading branch information
iTofu committed May 7, 2018
1 parent b4da83f commit aebf55f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Source/LCActionSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ typedef void(^LCActionSheetDidDismissHandler)(LCActionSheet *actionSheet, NSInte
Button's edge insets. Default is `UIEdgeInsetsMake(8.0, 15.0, 8.0f, 15.0f)`.
*/
@property (nonatomic, assign) UIEdgeInsets buttonEdgeInsets;
/**
ActionSheet's edge insets. Default is `UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)`.
*/
@property (nonatomic, assign) UIEdgeInsets actionSheetEdgeInsets;
///**
// ActionSheet's edge insets. Default is `UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)`.
// */
//@property (nonatomic, assign) UIEdgeInsets actionSheetEdgeInsets;

/**
Cell's separator color. Default is `RGBA(170/255.0f, 170/255.0f, 170/255.0f, 0.5f)`.
Expand Down
17 changes: 8 additions & 9 deletions Source/LCActionSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ - (instancetype)config:(LCActionSheetConfig *)config {
_unBlur = config.unBlur;
_blurEffectStyle = config.blurEffectStyle;
_titleEdgeInsets = config.titleEdgeInsets;
_actionSheetEdgeInsets = config.actionSheetEdgeInsets;
// _actionSheetEdgeInsets = config.actionSheetEdgeInsets;
_separatorColor = config.separatorColor;
_blurBackgroundColor = config.blurBackgroundColor;
_autoHideWhenDeviceRotated = config.autoHideWhenDeviceRotated;
Expand Down Expand Up @@ -369,14 +369,9 @@ - (void)setupView {
[bottomView addSubview:tableView];
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(bottomView);
CGFloat topInset = self.title.length > 0 ?self.titleEdgeInsets.bottom + self.actionSheetEdgeInsets.top : self.actionSheetEdgeInsets.top;
CGFloat bottomInset = self.actionSheetEdgeInsets.bottom;
CGFloat leftInset = self.actionSheetEdgeInsets.left;
CGFloat rightInset = self.actionSheetEdgeInsets.right;
make.top.equalTo(titleLabel.mas_bottom).offset(self.title.length > 0 ? self.titleEdgeInsets.bottom : 0);
CGFloat height = self.otherButtonTitles.count * self.buttonHeight;

make.top.equalTo(titleLabel.mas_bottom).offset(topInset);
make.height.equalTo(@(height + bottomInset));
make.height.equalTo(@(height));
}];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView = tableView;
Expand Down Expand Up @@ -707,7 +702,11 @@ - (NSString *)buttonTitleAtIndex:(NSInteger)index {

- (void)updateBottomView {
[self.bottomView mas_updateConstraints:^(MASConstraintMaker *make) {
CGFloat height = (self.title.length > 0 ? self.titleTextSize.height + 2.0f + (self.titleEdgeInsets.top + self.titleEdgeInsets.bottom) : 0) + (self.otherButtonTitles.count > 0 ? (self.canScrolling ? MIN(self.visibleButtonCount, self.otherButtonTitles.count) : self.otherButtonTitles.count) * self.buttonHeight : 0) + (self.cancelButtonTitle.length > 0 ? 5.0f + self.buttonHeight : 0) + ([[UIDevice currentDevice] lc_isX] ? 34.0 : 0);
CGFloat height =
(self.title.length > 0 ? self.titleTextSize.height + 2.0f + (self.titleEdgeInsets.top + self.titleEdgeInsets.bottom) : 0) +
(self.otherButtonTitles.count > 0 ? (self.canScrolling ? MIN(self.visibleButtonCount, self.otherButtonTitles.count) : self.otherButtonTitles.count) * self.buttonHeight : 0) +
(self.cancelButtonTitle.length > 0 ? 5.0f + self.buttonHeight : 0) +
([[UIDevice currentDevice] lc_isX] ? 34.0 : 0);
make.height.equalTo(@(height));
}];
}
Expand Down
8 changes: 4 additions & 4 deletions Source/LCActionSheetConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ NS_ASSUME_NONNULL_BEGIN
Title's edge insets. Default is `UIEdgeInsetsMake(8.0, 15.0, 8.0f, 15.0f)`.
*/
@property (nonatomic, assign) UIEdgeInsets buttonEdgeInsets;
/**
ActionSheet's edge insets. Default is `UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)`.
*/
@property (nonatomic, assign) UIEdgeInsets actionSheetEdgeInsets;
///**
// ActionSheet's edge insets. Default is `UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)`.
// */
//@property (nonatomic, assign) UIEdgeInsets actionSheetEdgeInsets;

/**
Cell's separator color. Default is `RGBA(170/255.0f, 170/255.0f, 170/255.0f, 0.5f)`.
Expand Down
2 changes: 1 addition & 1 deletion Source/LCActionSheetConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ - (instancetype)initSharedInstance {

self.titleEdgeInsets = UIEdgeInsetsMake(15.0f, 15.0f, 15.0f, 15.0f);
self.buttonEdgeInsets = UIEdgeInsetsMake(8.0, 15.0, 8.0, 15.0);
self.actionSheetEdgeInsets = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);
// self.actionSheetEdgeInsets = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);

self.separatorColor = kLCActionSheetColorA(150.0f, 150.0f, 150.0f, 0.3f);
self.blurBackgroundColor = kLCActionSheetBlurBgColorNormal;
Expand Down

0 comments on commit aebf55f

Please sign in to comment.