ここで基本的なものが欠けています。
各セルにNSDictionaryの内容が表示されたテーブルビューがあります。各セルをタップすると、同じ辞書の詳細を表示する新しいビューコントローラーに移動したいと思います。
しかし、辞書を渡そうとするたびに、その内容は反対側ではnullになります。
これが、テーブルビューを含むビューコントローラでのセグエの準備です。
-(void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"tableSegue"]){
MODetailViewController *detailViewController = [[MODetailViewController alloc] init];
NSIndexPath *selectedIndexPath = [self.monetiseTable indexPathForSelectedRow];
int selectedIndexPathAsInteger = selectedIndexPath.row;
NSDictionary *dictionaryToPass = [[NSDictionary alloc] initWithDictionary:[self.feedArray objectAtIndex:selectedIndexPathAsInteger]];
NSLog(@"%@", dictionaryToPass);
detailViewController.passedDictionary = dictionaryToPass;
}
}
NSLogは、期待どおりに辞書を表示します。
ここで、詳細ビューコントローラヘッダーでプロパティを宣言しました(私はARCを使用しています)。
@property (weak, nonatomic) NSDictionary *passedDictionary;
現在viewWillAppearにあります:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
NSLog(@"%@", self.passedDictionary);
}
NSLogがnullを返しています!?
私はそれを合成しました。
私は確かに基本的な何かが欠けています。何か助けはありますか?