【发布时间】:2018-03-17 13:10:28
【问题描述】:
这是我当前的代码:
import UIKit
import LocalAuthentication
class ViewController: UIViewController {
@IBAction func sendHelp(sender: UIButton){
let alert = UIAlertController(title: "It worked", message: "yey", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
它不检测按钮何时被按下。我不能在我的代码中使用 segues (control+drag),所以这可能是 Xcode 的问题。我该怎么办?
【问题讨论】:
-
这真的是你的完整代码吗? viewDidLoad 在哪里?没有这个,你的 ViewController 就不会加载 *_____”
-
请做一个新动作:选择故事板,按⌥⌘↩打开助手编辑器,⌃-从按钮拖到关联的视图控制器中,在弹出窗口中选择
IBAction和发送者@ 987654323@ 并按↩。注意方法签名的区别。 -
您的问题缺少很多重要的细节。
-
对以上所有答案:我会在我能回家的时候做这些。感谢您的所有帮助!
标签: swift