SCLAlertView按钮

时间:2018-09-06 13:15:55

标签: ios swift

当我使用第三方SCLAlertView时,实际上存在一个问题,就是我想在按下按钮时执行一些操作,但是只有自定义属性,但是我想知道操作范围是否有人可以帮助我出来吗?

2 个答案:

答案 0 :(得分:0)

您可以使用

 let appearance = SCLAlertView.SCLAppearance(
        showCloseButton: false // if you dont want the close button use false 
    )
    let alertView = SCLAlertView(appearance: appearance)
    alertView.addButton("Ok Pressed") {
        print("Ok button tapped")


    }
alertView.showSuccess("Success", subTitle: "")

您获得了add buttons的详细示例,并在default close buttons中隐藏了SCLAlertView属性

答案 1 :(得分:0)

我从未使用过该库,但是,如果我们看一下项目(https://github.com/vikmeup/SCLAlertView-Swift)的Github存储库,我们将看到以下示例:

alert.addButton("Show Name") {
    print("Text value: \(txt.text)")
}

点击按钮后执行print("Text value: \(txt.text)")的位置。

相关问题