Closed Sadow32 closed 2 years ago
[LEEAlert alert] 这个再拆一个
改了一下,这样确实正常了。
/// LeeAlert
/// @param title 标题
/// @param content 内容
/// @param actions 按钮数组
/// @param block 回调
+ (void)alertTitle:(nullable NSString *)title
content:(nullable NSString *)content
actions:(nonnull NSArray *)actions
block:(alertActionBlock)block {
LEEAlertConfig *alert = [LEEAlert alert];
alert.config.LeeAddTitle(^(UILabel * _Nonnull label) {
label.text = title;
label.textColor = UIColor.titleDarkColor;
label.font = [UIFont systemFontOfSize:15];
}).LeeAddContent(^(UILabel * _Nonnull label) {
label.text = content;
label.font = [UIFont systemFontOfSize:15];
label.textColor = UIColor.titleColor;
});
for (NSInteger i = 0; i < actions.count; i++) {
AlertActionModel *model = [actions objectAtIndex:i];
alert.config.LeeAddAction(^(LEEAction * _Nonnull action) {
action.title = model.title;
action.titleColor = model.color;
action.font = [UIFont systemFontOfSize:model.fontSize];
action.clickBlock = ^{
if (block) {
block(i, model.title);
}
};
});
}
alert.config.LeeShow();
}
good!
写了一个类方法,方法里的代码如下。
如果正常按照示例写就不会出现问题,这是正常现象吗,可以这么使用吗?