编辑代码

if resultl.count >= 1 {
btn.tag = tag
btn.addrarget(self, action: #selector(buttonCheckMusicTimer(_:)),
 for: .touchUpInside)
view.addSubview(btn)
}
}
//函数13:移除所有子控件
func removeAllSubViews(view:UIView)(
  if view.subviews.count>0(
     view.subviews.forEach(($0.removeFromSuperview()})
     }
     }
@IBAction func onTips(_ sender : UIButton){
TipsFlag =!TipsFlag
displayArrayGraphButtonTips()
}
@IBAction func orBegin( sender : UIButton){
//游戏结束标志
GameOver = false
//获取游戏开始时间并保存
beginTimestamp = getCurrentTimeStamp()
//倒计时
timeElapse()
//数组初始化
initGame()
distractorCreate(mount:10)
differenceCreate(mount: 8)
displayArrayGraphButtonTips()
}
@IBAction func onNext(_ sender : UIButton){
GameOver = true
TipsFlag = false
let myView1= self.view.viewWithTag(2001) as! UIImageView let myView2 = self.view.viewWithTag(2002) as! UIImageViewCurrentBackground+=1
if CurrentBackground >4 (
  CurrentBackground = 1
}
let image = UIImage(named: "back0\(CurrentBackground)")!
myViewl.image = image
myView2.image = image
removeAllSubViews(view:myView1)
removeAllSubViews(view:myView2)
}