首页 > 解决方案 > 在 SwiftEntryKit 中按下条目按钮后执行操作

问题描述

我在我的SwiftEntryKit弹出窗口中添加了 2 个按钮,但在按下按钮后无法弄清楚如何做某事。

我按照他们的警报示例设置的模式。

我尝试在解雇操作中输入一些内容,但没有成功:

// Ok Button
let okButtonLabelStyle = EKProperty.LabelStyle(font: buttonFont, color: buttonColor)
let okButtonLabel = EKProperty.LabelContent(text: "OK, ACCEPT", style: okButtonLabelStyle)
let okButton = EKProperty.ButtonContent(label: okButtonLabel, backgroundColor: .clear, highlightedBackgroundColor:  buttonColor.withAlphaComponent(0.05)) {
    SwiftEntryKit.dismiss {
        print("okButton")
    }

}

谢谢你。

标签: swift

解决方案


您必须为 的属性设置entryInteraction为。.absorbTouchesattributesSwiftEntryKit.display

var attributes = EKAttributes()
attributes.entryInteraction = .absorbTouches

[...]

SwiftEntryKit.display(entry: <entry variable>, using: attributes)

推荐阅读