编辑代码

var myString = "Hello world!     -  swift.jsrun.net"
print(myString)
func differerceCreate(mount:Int){
    for_in 0..<mount{
        let col = Int(arc4random()) % cols
        let row = Int(arc4randowm()) % rows
        errorCords.append((row,col))
        let ibdex = Int(arc4random()) % imag.count
        let which = Int(arc4random()) % 2
        if which == 0 {
            iv1[cols*row + cols] = images[index]
        }
        else
        iv2[cols*row + col] = image[index]
        }
    }
}
//修改Button函数支持音效
@objc func buttinCheckMusic(_sender :UIButton){
    let tipsLabel = self.view.viewWith Tag(1001) as! UILabel
    var tag = sender.tag
    if tag >= 5000{
        tag -= 5000
    }
    else if tag >= 4000{
        tag -= 4000
    }
    let roow =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:"birdspund",ofType:"m4a")
        leet url =URL(fileURLWithPath:path!)
        soundplayer=try? AVAidioplyer(conentsof:url)
        soundplayer.play()
        tipsLayre.text = "不同找到: (\(row),\(col))"
    }
    else{
        let path = Bundle.main.path(forResource:"error",ofType:"m4a")
        let url =URL(fileURLWithpath:path!)
        soundplayer=TRY? AVAidioplyer(conentsof:url)
        soundplayer.play()
        tipsLayre.text = "找错:(\(row),\(col))"
        }
    }
    btn1.addTarget(self,action:#selector(buttinCheckMusic(_:)),for:.touchUplnside)
    btn1.addTarget(self,action:#selector(buttinCheckMusic(_:)),for:.touchUplnside)
}