mirror of https://github.com/xaoxuu/ProHUD
去掉actionAxis配置
This commit is contained in:
parent
640e811f6d
commit
8992349953
|
@ -142,27 +142,19 @@ class AlertVC: ListVC {
|
|||
alert.vm.message = "本次消费需要你支付999软妹豆,确认支付吗?"
|
||||
alert.config.customActionStack { stack in
|
||||
stack.spacing = 0
|
||||
stack.axis = .vertical
|
||||
stack.axis = .vertical // 竖排按钮
|
||||
}
|
||||
} .onViewDidLoad { vc in
|
||||
guard let alert = vc as? Alert else {
|
||||
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 {
|
||||
let v = UIView()
|
||||
v.backgroundColor = UIColor("#f2f2f2")
|
||||
return v
|
||||
}
|
||||
let btn1 = alert.add(action: "确认,以后不需要再提醒", style: .plain(textColor: UIColor("#14cccc")))
|
||||
btn1.contentEdgeInsets.top = 16
|
||||
btn1.contentEdgeInsets.top = 16 + 1 // 间距 + 线的高度
|
||||
btn1.contentEdgeInsets.bottom = 16
|
||||
let line1 = createLine()
|
||||
btn1.insertSubview(line1, at: 0)
|
||||
|
@ -295,7 +287,6 @@ class AlertVC: ListVC {
|
|||
Alert(.loading) { alert in
|
||||
alert.vm.title = "在弹出过程中增加元素"
|
||||
alert.add(action: "OK", style: .gray)
|
||||
alert.config.actionAxis = .vertical
|
||||
} .onViewWillAppear { vc in
|
||||
guard let alert = vc as? Alert else {
|
||||
return
|
||||
|
@ -407,7 +398,6 @@ class AlertVC: ListVC {
|
|||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
alert.config.actionAxis = .vertical
|
||||
alert.add(contentSpacing: 24)
|
||||
alert.add(action: "OK", style: .gray)
|
||||
}
|
||||
|
|
|
@ -11,10 +11,6 @@ public extension Alert {
|
|||
|
||||
class Configuration: ProHUD.Configuration {
|
||||
|
||||
|
||||
/// 指定排列方向(默认两个按钮水平排列,超过时垂直排列)
|
||||
public var actionAxis: NSLayoutConstraint.Axis?
|
||||
|
||||
/// 堆叠深度
|
||||
public var stackDepth: CGFloat = 30
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ extension Alert: DefaultLayout {
|
|||
}
|
||||
|
||||
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
|
||||
guard count < 4 else { return }
|
||||
if (isPortrait && count < 3) || !isPortrait {
|
||||
|
@ -227,9 +227,6 @@ extension Alert {
|
|||
mk.left.right.equalToSuperview()
|
||||
}
|
||||
}
|
||||
if let axis = config.actionAxis {
|
||||
actionStack.axis = axis
|
||||
}
|
||||
} else {
|
||||
// 无按钮
|
||||
for v in actionStack.arrangedSubviews {
|
||||
|
|
Loading…
Reference in New Issue