我建立一個應用程序與UIAlertController,我想有一個按鈕,上面寫着「共享」,然後打開了類似添加共享動作的UIAlertController斯威夫特
似乎容易做,如果它不是一個子按鈕。
我的代碼:
}
@IBAction func buttonTapped(sender: UIButton) {
var title: String
if sender.tag == correctAnswer {
title = "Correct"
++score
} else {
title = "Wrong"
let ac = UIAlertController(title: title, message: "Your score was \(score).", preferredStyle: .Alert)
ac.addAction(UIAlertAction(title: "Try Again", style: .Default, handler: askQuestion))
ac.addAction(UIAlertAction(title: "Share", style: .Default, handler: share))
presentViewController(ac, animated: true, completion: nil)
gameOver = true
score = 0
}
我的共享功能目前尚未確定。
你在哪裏定義您完成處理程序爲您份額的行動? – pbush25