別のアラートを表示するUIAlertActionのハンドラを実装する必要があります。このコードのスニペットを見てください:
let firstAlert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
firstAlert.addTextFieldWithConfigurationHandler({
textField in
textField.placeholder = "Some input"
})
let secondAlert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
secondAlert.addTextFieldWithConfigurationHandler({
textField in
textField.placeholder = "Some input 2"
})
firstAlert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: {
action in
print("text from first alert : + \(firstAlert.textFields?[0].text)")
self.presentViewController(secondAlert, animated :true, completion :nil)
}))
secondAlert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: {
action in
print("text from second alert : + \(firstAlert.textFields?[0].text)")
}))
self.presentViewController(firstAlert, animated: true, completion: {
})
あなたはこのコードの行が最初のUIViewControllerを登場にviewDidLoad
またはviewDidAppear
機能、例えば、この使用を使用することができます。
希望しますか?
どのようなエラーが投げられますか?私たちはあなたを助けるためにさらに多くの情報が必要です。あなたのコードを掲載し、私達にエラーを与え、私たちはあなたをさらに助けることができます。 –