私のIBでは、あるUIViewController(識別子=リスト)から別のUIViewController(識別子=詳細)にプッシュするセグエを作成しました。その後、
prepareForSegue
これは、テスト目的で一部のデータを引き継ぐために行います。
Detail *detailsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Details"];
NSLog(@"Current \"Details\" class in use: %@",detailsViewController);
NSLog(@"Prep Complete, Testing begins==============");
detailsViewController.TitleField.text = @"Random Text";
detailsViewController.DuedateField.text = [NSString stringWithFormat:@"%@",[NSDate date]];
detailsViewController.ReminderFieldOne.text = [NSString stringWithFormat:@"%@",[NSDate date]];
detailsViewController.ReminderFieldTwo.text = [NSString stringWithFormat:@"%@",[NSDate date]];
detailsViewController.NotesArea.text = @"Note 1: This doesnt seem to work.";
NSLog(@"Items from %@:",detailsViewController);
NSLog(@"Title Field = %@",detailsViewController.TitleField.text);
NSLog(@"Duedate field = %@",detailsViewController.DuedateField.text);
NSLog(@"Reminder field 1 = %@",detailsViewController.ReminderFieldOne.text);
NSLog(@"Reminder field 2 = %@",detailsViewController.ReminderFieldTwo.text);
NSLog(@"Notes = %@",detailsViewController.NotesArea.text);
NSLog(@"===============Testing Complete");
しかし、ほとんどすべてのNSLogは、データが送信されたのと同じdetailsViewControllerから(null)値を返します。
2012-02-08 13:38:53.016 TodoApp[10132:fb03] Items from <Detail: 0x6d70120>:
2012-02-08 13:38:53.017 TodoApp[10132:fb03] Title Field = (null)
2012-02-08 13:38:53.017 TodoApp[10132:fb03] Duedate field = (null)
2012-02-08 13:38:53.018 TodoApp[10132:fb03] Reminder field 1 = (null)
2012-02-08 13:38:53.019 TodoApp[10132:fb03] Reminder field 2 = (null)
2012-02-08 13:38:53.020 TodoApp[10132:fb03] Notes = (null)
なぜそれが(null)であるかを理解するために、私はしばらくそれをやっています。なぜこれが起こるのか誰かが何か手がかりを持っていますか?私は何かが足りないのですか?
御時間ありがとうございます!
編集:編集された詳細ビューとロードされた詳細ビューは異なるように見えますが、ログが編集されたものと同じ詳細ビューからフェッチデータを返す(null)理由を説明していません。
2012-02-08 14:41:11.937 TodoApp[10567:fb03] Current "Details" class in use: <Detail: 0x6a883a0>
2012-02-08 14:41:11.937 TodoApp[10567:fb03] Prep Complete, Testing begins==============
2012-02-08 14:41:11.939 TodoApp[10567:fb03] Items from <Detail: 0x6a883a0>:
2012-02-08 14:41:11.940 TodoApp[10567:fb03] Title Field = (null)
2012-02-08 14:41:11.940 TodoApp[10567:fb03] Duedate field = (null)
2012-02-08 14:41:11.941 TodoApp[10567:fb03] Reminder field 1 = (null)
2012-02-08 14:41:11.942 TodoApp[10567:fb03] Reminder field 2 = (null)
2012-02-08 14:41:11.942 TodoApp[10567:fb03] Notes = (null)
2012-02-08 14:41:11.943 TodoApp[10567:fb03] ===============Testing Complete
2012-02-08 14:41:11.953 TodoApp[10567:fb03] View Loaded: <Detail: 0x6d1feb0>
代わりにロードするようにアプリに指示する方法はありますか?