【发布时间】:2021-09-20 18:41:50
【问题描述】:
我一直在尝试构建一个允许我单击按钮并播放音频的 IOS 应用程序,但我遇到了这个错误,只有实例方法可以声明为 @IBAction。我进行了搜索,似乎我没有将它从课堂上关闭或类似的东西,但它仍然不想工作
import UIKit
import AVFoundation
class LevelAStartingSoundViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
@IBAction func Sbutton(_ sender: Any, forEvent event: UIEvent) {
playSound(sound: "Ssound", type: "wav")
}
}
}
【问题讨论】:
标签: swift uikit swift5 ibaction