lixiang1994 / LEEAlert

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

action的位置问题 #76

Closed heyehao2008 closed 5 years ago

heyehao2008 commented 5 years ago

action有的是左右结构,有的是上下结构,这个是什么参数在控制? 我看demo没有什么参数在控制action的位置结构。都是直接LeeAddAction 。但是有的alert就是左右结构,有的就是上下结构。很迷惑

比如demo里面的 显示一个蓝色自定义风格的alert弹框:(左右结构)

UIColor *blueColor = [UIColor colorWithRed:90/255.0f green:154/255.0f blue:239/255.0f alpha:1.0f];

            [LEEAlert alert].config
            .LeeAddTitle(^(UILabel *label) {

                label.text = @"确认删除?";

                label.textColor = [UIColor whiteColor];
            })
            .LeeAddContent(^(UILabel *label) {

                label.text = @"删除后将无法恢复, 请慎重考虑";

                label.textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.75f];
            })
            .LeeAddAction(^(LEEAction *action) {

                action.type = LEEActionTypeCancel;

                action.title = @"取消";

                action.titleColor = blueColor;

                action.backgroundColor = [UIColor whiteColor];

                action.clickBlock = ^{

                    // 取消点击事件Block
                };
            })
            .LeeAddAction(^(LEEAction *action) {

                action.type = LEEActionTypeDefault;

                action.title = @"删除";

                action.titleColor = blueColor;

                action.backgroundColor = [UIColor whiteColor];

                action.clickBlock = ^{

                    // 删除点击事件Block
                };
            })
            .LeeHeaderColor(blueColor)
            .LeeShow();

显示一个评分的alert弹框:(上下结构)

[LEEAlert alert].config
            .LeeTitle(@"评个分吧")
            .LeeAddContent(^(UILabel *label) {

                label.text = @"如果您觉得不错, 那就给个五星好评吧 亲~";

                label.textColor = [UIColor grayColor];
            })
            .LeeAddAction(^(LEEAction *action) {

                action.title = @"果断拒绝";

                action.titleColor = [UIColor darkGrayColor];

                action.backgroundColor = [UIColor colorWithRed:249/255.0f green:249/255.0f blue:249/255.0f alpha:1.0f];

                action.backgroundHighlightColor = [UIColor colorWithRed:239/255.0f green:239/255.0f blue:239/255.0f alpha:1.0f];

                action.insets = UIEdgeInsetsMake(0, 10, 10, 10);

                action.borderPosition = LEEActionBorderPositionTop
                | LEEActionBorderPositionBottom
                | LEEActionBorderPositionLeft
                | LEEActionBorderPositionRight;

                action.borderWidth = 1.0f;

                action.borderColor = action.backgroundHighlightColor;

                action.cornerRadius = 5.0f;
            })
            .LeeAddAction(^(LEEAction *action) {

                action.title = @"立刻吐槽";

                action.titleColor = [UIColor darkGrayColor];

                action.backgroundColor = [UIColor colorWithRed:249/255.0f green:249/255.0f blue:249/255.0f alpha:1.0f];

                action.backgroundHighlightColor = [UIColor colorWithRed:239/255.0f green:239/255.0f blue:239/255.0f alpha:1.0f];

                action.insets = UIEdgeInsetsMake(0, 10, 10, 10);

                action.borderPosition = LEEActionBorderPositionTop
                | LEEActionBorderPositionBottom
                | LEEActionBorderPositionLeft
                | LEEActionBorderPositionRight;

                action.borderWidth = 1.0f;

                action.borderColor = action.backgroundHighlightColor;

                action.cornerRadius = 5.0f;
            })
            .LeeAddAction(^(LEEAction *action) {

                action.type = LEEActionTypeCancel;

                action.title = @"五星好评";

                action.titleColor = [UIColor whiteColor];

                action.backgroundColor = [UIColor colorWithRed:243/255.0f green:94/255.0f blue:83/255.0f alpha:1.0f];

                action.backgroundHighlightColor = [UIColor colorWithRed:219/255.0f green:100/255.0f blue:94/255.0f alpha:1.0f];

                action.insets = UIEdgeInsetsMake(0, 10, 10, 10);

                action.borderPosition = LEEActionBorderPositionTop
                | LEEActionBorderPositionBottom
                | LEEActionBorderPositionLeft
                | LEEActionBorderPositionRight;

                action.borderWidth = 1.0f;

                action.borderColor = action.backgroundHighlightColor;

                action.cornerRadius = 5.0f;
            })
            .LeeCornerRadius(2.0f)
            .LeeShow();
lixiang1994 commented 5 years ago

两个action是左右, 一个或多个是上下 遵循苹果设计规则

heyehao2008 commented 5 years ago

那两个action的时候不能设置为上下结构吗?实际开发中还是有不少两个action上下排列的设计图

lixiang1994 commented 5 years ago

目前还不支持,不过都可以通过自定义视图的方式达到你想要的效果

LEE 邮箱:18611401994@163.com

Signature is customized by Netease Mail Master

在2019年09月25日 12:49,Ronda Ho 写道:

那两个action的时候不能设置为上下结构吗?实际开发中还是有不少两个action上下排列的设计图

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.