语句前的方法调用

时间:2018-07-31 07:53:22

标签: ios swift

当我的buttontouchfinished方法调用时,该方法中的语句在调用字母顺序方法之后被调用,我该怎么做才能在方法调用之前调用语句。我是IOS的新手.....

@objc func btnTouchFinished(sender: UIButton, withevent: UIEvent)  {


    if i == 1 && sender.frame.intersects(button3.frame) {
        if sender.frame == movingChar.frame {

       sender.frame = button3.frame
        button3.setTitle("3", for: .normal)
        movingChar.setTitle(nil, for: .normal)

        movingChar2.isHidden = true
        movingChar3.isHidden = true
        let audio = self.ap.setupAudioPlayerWithFile(file: "Good Job", type: "mp3")
        audio?.play()
        sleep(2)

        alphabeticOrder(numbers: [1,2,3,4,5])



        } else {
            let audio = self.ap.setupAudioPlayerWithFile(file: "wrong_drop", type: "mp3")
            audio?.play()
            sender.frame = btnframe

        }

,并且方法字母顺序​​为-

func alphabeticOrder(numbers: [Int])  {

    for var z in 0...numbers.count - 1 {

    let audio = self.ap.setupAudioPlayerWithFile(file: "\(numbers[z])", type: "mp3")
            audio?.play()
            sleep(2)
          //  self.nextQuiz.isHidden = false

    }



}

0 个答案:

没有答案