【问题标题】:UIView as UIButton not working (CocoaPod: LGButton)UIView 作为 UIButton 不起作用(CocoaPod:LGButton)
【发布时间】:2021-03-18 09:25:45
【问题描述】:

我想使用this cocoa pod 作为按钮。我选择了一个 UIView,将其类和模块设置为 LGButton 并编辑了设计。然后我意识到我无法得到它的反馈。因此,如果您按下 LG 按钮,代码将无法识别输入。我的代码:

@IBAction func thisLocationPressed(_ sender: LGButton) {
    print("BUTTON PRESSED")
    sender.isLoading = true
    let deadlineTime = DispatchTime.now() + .seconds(3)
    DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
    sender.isLoading = false
    }
}

是的,我将它链接到 Main.storyboard 中的 LGButton。当我按下按钮时,控制台从不显示“BUTTON PRESSED”......有人知道为什么吗?

谢谢!

【问题讨论】:

    标签: ios swift uiview uibutton cocoapods


    【解决方案1】:

    解决方案:

    将事件发送为“值已更改”-> 更改为“内部修饰”。现在工作:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多