去掉actionAxis配置

This commit is contained in:
xaoxuu 2023-05-17 16:20:13 +08:00
parent 640e811f6d
commit 8992349953
3 changed files with 3 additions and 20 deletions

View File

@ -142,27 +142,19 @@ class AlertVC: ListVC {
alert.vm.message = "本次消费需要你支付999软妹豆确认支付吗" alert.vm.message = "本次消费需要你支付999软妹豆确认支付吗"
alert.config.customActionStack { stack in alert.config.customActionStack { stack in
stack.spacing = 0 stack.spacing = 0
stack.axis = .vertical stack.axis = .vertical //
} }
} .onViewDidLoad { vc in } .onViewDidLoad { vc in
guard let alert = vc as? Alert else { guard let alert = vc as? Alert else {
return return
} }
// alert.add(contentSpacing: 30)
// let v = UIView()
// v.backgroundColor = UIColor("#f2f2f2")
// alert.add(subview: v).snp.makeConstraints { make in
// make.left.right.equalToSuperview()
// make.height.equalTo(1)
// }
// alert.add(contentSpacing: 16)
func createLine() -> UIView { func createLine() -> UIView {
let v = UIView() let v = UIView()
v.backgroundColor = UIColor("#f2f2f2") v.backgroundColor = UIColor("#f2f2f2")
return v return v
} }
let btn1 = alert.add(action: "确认,以后不需要再提醒", style: .plain(textColor: UIColor("#14cccc"))) let btn1 = alert.add(action: "确认,以后不需要再提醒", style: .plain(textColor: UIColor("#14cccc")))
btn1.contentEdgeInsets.top = 16 btn1.contentEdgeInsets.top = 16 + 1 // + 线
btn1.contentEdgeInsets.bottom = 16 btn1.contentEdgeInsets.bottom = 16
let line1 = createLine() let line1 = createLine()
btn1.insertSubview(line1, at: 0) btn1.insertSubview(line1, at: 0)
@ -295,7 +287,6 @@ class AlertVC: ListVC {
Alert(.loading) { alert in Alert(.loading) { alert in
alert.vm.title = "在弹出过程中增加元素" alert.vm.title = "在弹出过程中增加元素"
alert.add(action: "OK", style: .gray) alert.add(action: "OK", style: .gray)
alert.config.actionAxis = .vertical
} .onViewWillAppear { vc in } .onViewWillAppear { vc in
guard let alert = vc as? Alert else { guard let alert = vc as? Alert else {
return return
@ -407,7 +398,6 @@ class AlertVC: ListVC {
} else { } else {
// Fallback on earlier versions // Fallback on earlier versions
} }
alert.config.actionAxis = .vertical
alert.add(contentSpacing: 24) alert.add(contentSpacing: 24)
alert.add(action: "OK", style: .gray) alert.add(action: "OK", style: .gray)
} }

View File

@ -11,10 +11,6 @@ public extension Alert {
class Configuration: ProHUD.Configuration { class Configuration: ProHUD.Configuration {
///
public var actionAxis: NSLayoutConstraint.Axis?
/// ///
public var stackDepth: CGFloat = 30 public var stackDepth: CGFloat = 30

View File

@ -113,7 +113,7 @@ extension Alert: DefaultLayout {
} }
func setDefaultAxis() { func setDefaultAxis() {
guard isViewDisplayed == false && config.actionAxis == nil && config.customActionStack == nil else { return } guard isViewDisplayed == false && config.customActionStack == nil else { return }
let count = actionStack.arrangedSubviews.filter({ $0.isKind(of: UIControl.self )}).count let count = actionStack.arrangedSubviews.filter({ $0.isKind(of: UIControl.self )}).count
guard count < 4 else { return } guard count < 4 else { return }
if (isPortrait && count < 3) || !isPortrait { if (isPortrait && count < 3) || !isPortrait {
@ -227,9 +227,6 @@ extension Alert {
mk.left.right.equalToSuperview() mk.left.right.equalToSuperview()
} }
} }
if let axis = config.actionAxis {
actionStack.axis = axis
}
} else { } else {
// //
for v in actionStack.arrangedSubviews { for v in actionStack.arrangedSubviews {