ViewController
アラートビューで「次へ」ボタンを押すと、配列を別の配列に渡したいと思います。
userInformation += [userName, userGender, String(userAge), String(userHeight), String(userWeight)]
let alert = UIAlertController(title:"Confirmation", message: confirmationMessage, preferredStyle: UIAlertControllerStyle.Alert)
let confirmBtn : UIAlertAction = UIAlertAction(title: "Next", style: UIAlertActionStyle.Default, handler: {(action:UIAlertAction!)-> Void in
let vc = (self.storyboard?.instantiateViewControllerWithIdentifier("toPerInfo"))! as UIViewController
print(self.userInformation)
self.showDetailViewController(vc, sender: self)
})
let cancelBtn : UIAlertAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)
alert.addAction(cancelBtn)
alert.addAction(confirmBtn)
self.presentViewController(alert, animated: true, completion: nil)
そしてここにperpareForSegue
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var destViewController: PersonalInformation = segue.destinationViewController as! PersonalInformation
var arrayToSegue: [String] = self.userInformation
destViewController.useInfo = arrayToSegue
}
perpareForSegue
「次へ」ボタンに入れたいと思います。コードをどのように変更すればよいですか..他の同様の質問が見つかりませんでした...