Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在简单代码中发送到实例的选择器无法识别_Ios_Swift - Fatal编程技术网

Ios 在简单代码中发送到实例的选择器无法识别

Ios 在简单代码中发送到实例的选择器无法识别,ios,swift,Ios,Swift,我可以问下面的问题吗 [quick.ViewController shownextquestionwithsender:]:无法识别 选择器已发送到实例0x7ff0b150c720 发生在以下代码处。我不明白这是什么意思 class ViewController: UIViewController { @IBOutlet var questionLabel: UILabel! @IBOutlet var answerLabel: UILabel! let quest

我可以问下面的问题吗

[quick.ViewController shownextquestionwithsender:]:无法识别 选择器已发送到实例0x7ff0b150c720

发生在以下代码处。我不明白这是什么意思

class ViewController: UIViewController { 

    @IBOutlet var questionLabel: UILabel!
    @IBOutlet var answerLabel: UILabel!

    let questions: [String] = ["birth daut?", "name?", "birth son?"]
    let answers: [String] = ["12wol4il", "yuha", "54"]
    var currentQuestionIndex: Int = 0

    @IBAction func showNextQuestion(sender: AnyObject) {
        currentQuestionIndex+=1
        if currentQuestionIndex == questions.count
        {
            currentQuestionIndex = 0
        }

        let question: String = questions[currentQuestionIndex]
        questionLabel.text = question
        answerLabel.text = "???"
    }

    @IBAction func showAnswer(sender: AnyObject) {
        let answer: String = answers[currentQuestionIndex]
        answerLabel.text = answer
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        questionLabel.text = questions[currentQuestionIndex]
    }
}

你的故事板上有一个输入错误


showNextQuestion应为showNextQuestion

检查序列图像板中此操作按钮的插座连接。您可能已在序列图像板上连接了showNextQuestion和Sender,但实际方法不在控制器中,从情节提要中检查按钮上的连接,并从按钮的连接中删除ShowNextQuestionWithSender。代码格式无法识别的选择器表示有人试图调用某个函数,但该函数不存在。请附加更多调试输出。它告诉您找不到哪个函数。按⇧⌘F、 将错误的选择器复制并粘贴(不是键入!)到搜索字段中,按return。单击搜索结果并修复错误(打字错误)。