lixiang1994 / LEEAlert

优雅的可自定义 Alert ActionSheet
MIT License
1.3k stars 204 forks source link

使用actionsheet来添加LeeAddCustomView出现问题 #172

Open fengshh93 opened 2 years ago

fengshh93 commented 2 years ago

自定义一个table列表,当数据比较多时,按钮会跟着滚动,原因是刚好ATShareEditListView高度多出了50pt,导致按钮跟随滚动

ATShareEditListView view = [[ATShareEditListView alloc] initWithFrame:CGRectMake(0, 0, kSCREEN_WIDTH, 0) style:UITableViewStylePlain]; [LEEAlert actionsheet].config .LeeTitle(@"关闭后不显示在分享页面") .LeeAddCustomView(^(LEECustomView custom) { custom.view = view; }) .LeeHeaderInsets(UIEdgeInsetsMake(10, 0, 0, 0)) .LeeAddAction(^(LEEAction *action) { action.height = 44; action.type = LEEActionTypeDefault; action.title = @"确认"; action.titleColor = [UIColor whiteColor]; action.insets = UIEdgeInsetsMake(6, 16, 6, 16); action.backgroundColor = UIColor.atMainColor; action.backgroundHighlightColor = UIColor.atMainColor; action.cornerRadius = 5.0f;

        })
        .LeeCornerRadius(0.0f) // 设置圆角曲率为0
        .LeeConfigMaxWidth(^CGFloat(LEEScreenOrientationType type) {
            // 这是最大宽度为屏幕宽度 (横屏和竖屏)
            return CGRectGetWidth([[UIScreen mainScreen] bounds]);
        })
        .LeeConfigMaxHeight(^CGFloat(LEEScreenOrientationType type) {
            // 这是最大宽度为屏幕宽度 (横屏和竖屏)
            return CGRectGetHeight([[UIScreen mainScreen] bounds])*0.9;
        })
        .LeeActionSheetBottomMargin(0.0f) // 设置底部距离屏幕的边距为0
        .LeeActionSheetBackgroundColor([UIColor whiteColor])
        .LeeShow();
lixiang1994 commented 2 years ago

你可以尝试限制customView的高度达到你想要的效果吧