Q&A選擇題|認識動物
Published in
Jan 6, 2021
問答題做完,做選擇題
🌟畫面包含:
1. 建立IBOutlet:
・UIButton 顯示選擇題之選項(動物圖片)
・UISlider 顯示當前題數
・UILabel 當前題數之數字、顯示題目
2. viewDidLoad( )
3. 建立IBAction:
・UIButton 選擇題選項
・UIButton 說出題目
・UIButton 下一題
1. 建立IBOutlet
建立startGame( ) function ,就不用一直重複打同樣的code
2. viewDidLoad( )
3. 建立IBAction
UIButton選擇題選項
UIButton 說出答案
@IBAction func speak(_ sender: UIButton) {let speechUtterance = AVSpeechUtterance(string: questionLabel.text!)
let synthesizer = AVSpeechSynthesizer()
synthesizer.speak(speechUtterance)
}
UIButton 下一題