Files
OrderScheduling/OrderScheduling/Common/View/CommonAlertView.swift
DDIsFriend 24ca30ea90 update
2023-09-01 11:35:47 +08:00

111 lines
4.0 KiB
Swift

//
// CommonAlertView.swift
// OrderScheduling
//
// Created by on 2023/9/1.
//
import Foundation
import DDControlsKit_Private
import DDAutoUIKit_Private
open class CommonAlertView : DDView{
private let radiusView : DDView
private let scrollView : DDScrollView
private let scrollContentView : DDView
public let contentLabel : DDLabel
public let horizontalLine : DDView
public let verticalLine : DDView
public let cancelButton : DDButton
public let sureButton : DDButton
public override init(frame: CGRect) {
radiusView = DDView.init()
scrollView = DDScrollView()
scrollContentView = DDView.init()
contentLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(17)), textColor: .black.alpha(0.5))
horizontalLine = DDView()
verticalLine = DDView()
cancelButton = DDButton.dd_initCustom()
sureButton = DDButton.dd_initCustom()
super.init(frame: frame)
radiusView.layer.cornerRadius = auto(10)
radiusView.layer.masksToBounds = true
addSubview(radiusView)
radiusView.addSubview(scrollView)
scrollView.addSubview(scrollContentView)
contentLabel.numberOfLines = 0
contentLabel.textAlignment = .center
contentLabel.text = ""
scrollContentView.addSubview(contentLabel)
horizontalLine.backgroundColor = .hex("979797").alpha(0.35)
radiusView.addSubview(horizontalLine)
verticalLine.backgroundColor = .hex("979797").alpha(0.35)
verticalLine.isHidden = true
radiusView.addSubview(verticalLine)
cancelButton.setTitle("取消", for: .normal)
cancelButton.titleLabel?.font = .mediumFont(auto(14))
cancelButton.backgroundColor = .white
cancelButton.setTitleColor(.black.alpha(0.3), for: .normal)
radiusView.addSubview(cancelButton)
sureButton.setTitle("确定", for: .normal)
sureButton.setTitleColor(.white, for: .normal)
sureButton.titleLabel?.font = .mediumFont(auto(14))
sureButton.backgroundColor = .hex("1C62D9")
radiusView.addSubview(sureButton)
radiusView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
scrollView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalTo(horizontalLine.snp.top)
}
scrollContentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
make.width.equalToSuperview()
make.height.greaterThanOrEqualToSuperview()
}
contentLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(auto(20))
make.top.equalToSuperview().offset(auto(20))
make.right.equalTo(-auto(20))
make.bottom.equalTo(scrollContentView).offset(-auto(20))
}
horizontalLine.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-auto(40))
make.left.right.equalToSuperview()
make.height.equalTo(1)
}
verticalLine.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(horizontalLine.snp.bottom)
make.bottom.equalToSuperview()
make.width.equalTo(1)
}
cancelButton.snp.makeConstraints { make in
make.left.equalToSuperview()
make.right.equalTo(verticalLine.snp.left)
make.top.equalTo(horizontalLine.snp.bottom)
make.bottom.equalToSuperview()
}
sureButton.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.right.equalToSuperview()
make.top.equalTo(horizontalLine.snp.top)
make.left.equalTo(verticalLine.snp.right)
}
}
public required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}