@objc func buttonCheckMusic(_ sender : UIButton) {
let tipsLabe1 = self.view.viewWithTag(1001) as! UILabel
var tag = sender.tag
if tag >= 5000 {
tag -= 5000
}
else if tag >= 4000 {
tag -= 4000
}
let row = Int (tag / cols)
let col = tag - cols * row
let result = errorCords.filter {
$0 == (row,col)
}
if result.count >= 1 {
let path = Bundle.main.path(forResource:"birdsound",ofType:"m4a")
let url = URL(fileURLWithPath: path!)
soundPlayer=try? AVAudioPlayer(contentsOf: url)
soundPlayer.play()
tipsLabe1.text = "不同找到: (\(row),\(col))"
}
else {
let path = Bundle.main.path(forResource: "error", ofType:"m4a")
let url = URL(fileURLWithPath: path!)
soundPlayer=try? AVAudioPlayer(contentsOf: url)
soundPlayer.play()
tipsLabe1.text = "找错啦: (\(row),\(col))"
}
}