Sorry, but I canβt post my source code because it contains confidential information. When I have more free time, I will create a separate project and upload the code somewhere.
Here are excerpts from how I have done so far (welcome any feedback).
RootViewController - Note I have 4 partitions in my root table.
#pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES];
NSNotificationCenter Part
Add this to the ProductSearchViewController:
#pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *itemAtIndex = (NSDictionary *)[self.productResults objectAtIndex:indexPath.row]; [[NSNotificationCenter defaultCenter] postNotificationName:@"updateProduct" object:itemAtIndex]; }
And finally add this to ProductSearchDetailViewController:
- (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateTheProductDetails:) name:@"updateProduct" object:nil]; } - (void)updateTheProductDetails:(NSNotification *)notification { NSDictionary *productDictionary = [NSDictionary dictionaryWithDictionary:[notification object]];
Hope this helps!
Ksoza source share