I'm missing something fundamental here.
I have a table view with each cell displaying the contents of an NSDictionary. When I tap on each cell I would like to segue to a new view controller displaying details from the same dictionary.
But every time i try pass the dictionary it's contents are null on the other side.
Here's my prepare for segue in the view controller containing the table view:
-(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;
}
}
The NSLog displays the dictionary as expected.
Now, in detail view controller header I have declared the property (i'm using ARC):
@property (weak, nonatomic) NSDictionary *passedDictionary;
Now in viewWillAppear:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
NSLog(@"%@", self.passedDictionary);
}
The NSLog is returning null!?
I have synthesised it.
I'm missing something fundamental i'm sure. Any help?