编辑代码

@objc func buttonCheck(_sender : UIButton) {
    let tipsLabel = self.view.viewWithTag(1001) as! UILabel
    let tag = sender.tag
    if tag >=5000 {
        let row = Int ((tag - 5000) / cols)
        let col = tag - 5000 - cols * row
        print("Bottom(\(row),\(rol))")
        tipsLabel.text = "Bottom(\(row),\(col))"
    }
    else if tag >= 4000 {
        let row = Int ((tag - 4000) / cols)
        let ccol = tag - 4000 - cols * row
        print("Top(\(row),\(col))")
        tipsLabel.tex = "Top(\(row),\(col))"
    }
    else {
        print("Button.tag=\(sender.tag)")
        tipsLabel.tex = "Button.tag=\(sender.tag)"
    }
}