【发布时间】:2018-01-05 02:10:08
【问题描述】:
我了解以下内容将返回被按下按钮的标题。
let myString = sender.title(for: .normal)!
但我真的很想知道为什么会这样。我在 Apple documentation for UIButton 中找不到它。
我在另一个线程中读到 sender 是 Any 类型的参数而不是 UIButton,但我希望能在破译此语法方面提供任何帮助。
【问题讨论】:
-
通常这个方法被系统调用,按钮的实例作为参数传递。这就是为什么在方法中,你可以得到按钮。
标签: ios swift3 uibutton sender