91 lines
3.9 KiB
Plaintext
91 lines
3.9 KiB
Plaintext
//
|
|
// TTAlertConfig.m
|
|
// YM_TTChatViewKit
|
|
//
|
|
// Created by lee on 2019/5/20.
|
|
// Copyright © 2023 YUMI. All rights reserved.
|
|
//
|
|
|
|
#import "TTAlertConfig.h"
|
|
#import "UIImage+Utils.h"
|
|
#import "DJDKMIMOMColor.h"
|
|
|
|
static CGFloat kAlertTitleFont = 18.f;
|
|
static CGFloat kAlertButtonFont = 15.f;
|
|
static CGFloat kAlertMessageFont = 15.f;
|
|
static CGFloat kAlertCornerRadius = 12.f;
|
|
static CGFloat kAlertBackgroundColorAlpha = 0.3;
|
|
static CGFloat kAlertMessageFontLineSpace = -1;
|
|
static CGFloat kAlertButtonCornerRadius = 8.f;
|
|
|
|
@implementation TTAlertConfig
|
|
|
|
- (instancetype)init {
|
|
self = [super init];
|
|
if (self) {
|
|
|
|
_backgroundColor = [DJDKMIMOMColor alertBackgroundColor];
|
|
|
|
//背景颜色
|
|
kAlertTitleFont = 16.f;
|
|
kAlertCornerRadius = 14.f;
|
|
kAlertButtonCornerRadius = 19.f;
|
|
|
|
_actionStyle = TTAlertActionBothStyle;
|
|
|
|
// title
|
|
_title = @"";// 标题
|
|
_titleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:kAlertTitleFont];// 字体
|
|
_titleColor = [DJDKMIMOMColor alertTitleColor];// 颜色
|
|
|
|
// message
|
|
_message = @"";
|
|
_messageFont = [UIFont systemFontOfSize:kAlertMessageFont];// 内容
|
|
_messageColor = [DJDKMIMOMColor alertMessageColor];// 颜色
|
|
_messageLineSpacing = kAlertMessageFontLineSpace;// 字体行间距
|
|
_messageAttributedConfig = @[];// 自定义富文本样式
|
|
_messageTextAlignment = NSTextAlignmentCenter;
|
|
|
|
// cancel button
|
|
_cancelButtonConfig = [[TTAlertButtonConfig alloc] init];
|
|
_cancelButtonConfig.title = YMLocalizedString(@"XPRoomSettingInputView4");// 取消按钮
|
|
_cancelButtonConfig.font = [UIFont systemFontOfSize:kAlertButtonFont];// 按钮字体
|
|
_cancelButtonConfig.titleColor = [DJDKMIMOMColor cancelButtonTextColor];// 字体颜色
|
|
_cancelButtonConfig.backgroundImage = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor cancelButtonGradientStartColor], [DJDKMIMOMColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
|
_cancelButtonConfig.cornerRadius = kAlertButtonCornerRadius;// 按钮背景图
|
|
|
|
|
|
// confirm button
|
|
_confirmButtonConfig = [[TTAlertButtonConfig alloc] init];
|
|
_confirmButtonConfig.title = YMLocalizedString(@"TTAlertConfig0");
|
|
_confirmButtonConfig.font = [UIFont systemFontOfSize:kAlertButtonFont];
|
|
_confirmButtonConfig.titleColor = [DJDKMIMOMColor confirmButtonTextColor];
|
|
_confirmButtonConfig.backgroundImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xE29030), UIColorFromRGB(0xFCC074)]
|
|
gradientType:GradientTypeLeftToRight
|
|
imgSize:CGSizeMake(10, 10)];
|
|
_confirmButtonConfig.cornerRadius = kAlertButtonCornerRadius;
|
|
|
|
// // 创建渐变图层
|
|
// CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
|
// gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
|
|
// (__bridge id)UIColorFromRGB(0xFCC074).CGColor];
|
|
// gradientLayer.startPoint = CGPointMake(0.0, 0.0); // 顶部中央
|
|
// gradientLayer.endPoint = CGPointMake(0.0, 1.0); // 底部中央
|
|
// gradientLayer.frame = CGRectMake(0, 0, 120, 38); // 设置渐变图层大小
|
|
//
|
|
// // 将渐变图层添加到按钮图层
|
|
// [_previewActionButton.layer insertSublayer:gradientLayer atIndex:0];
|
|
|
|
_cornerRadius = kAlertCornerRadius;// 默认圆角
|
|
_shouldDismissOnBackgroundTouch = YES;// 点击蒙层是否消失
|
|
|
|
// mask default 0.3 black
|
|
_maskBackgroundAlpha = kAlertBackgroundColorAlpha; // alert 背景色
|
|
_disableAutoDismissWhenClickButton = NO;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
@end
|
|
|