私はVocabアプリケーションを作成しようとしています。最初のViewControllerは静的なTableViewで、ユーザはあなたが覚えたい単語の日付を選択できます。すべてのday_vocabulary配列はこのViewControllerにあり、1つの配列には30のボキャブラリが含まれています。私は90日間vocabを持っています。prepareForSegueを使用して特定のデータを別のViewControlに渡す
ユーザが日付を選択すると、このViewCotrollerは30個のボキャブラリを表示する別のビューに配列を渡します。ここでは、特定のデータを別のViewControlに90個のセグを使用して渡そうとしましたが、全体的に見栄えが悪いです。また、私はこのようにdidSelectRowAtIndexPathを使用しようとした、
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.section == 0 && indexPath.row == 0 {
performSegueWithIdentifier("dayVocab1", sender: nil)
}
}
は、私は別の記事を読んでストーリーボードを使用せずに、セグエの識別子を設定することができないことに気づき、だから、結果は同じになります。
特定のデータを1つのセグだけで渡すことを知りたいと思います。
ここでは、準備のための別のコードを示します。 prepareForSegue FUNC
オーバーライド(:UIStoryboardSegue、送信者:セグエ?ANYOBJECT){
if (segue.identifier == "dayVocab1") {
let destViewController : ViewController = segue.destinationViewController as! ViewController
destViewController.vocabData = vocab_day1p1
destViewController.meaningData = meaning_day1p1
}
if (segue.identifier == "dayVocab2") {
let destViewController : ViewController = segue.destinationViewController as! ViewController
destViewController.vocabData = vocab_day1p2
destViewController.meaningData = meaning_day1p2
}
}私は、送信者を使用して考えて
は、
解決の鍵となり、私は何を知っているだろう聞かせくださいこれに最適な解決策になります。
ありがとうございます。
これ以上のセグは必要ありません! –
それはあなたのために働いてうれしい。どうもありがとうございました。乾杯 – rach