As you are using both two controllers in tab bar, So there is no any option to set delegate to each other. Instead what you can do is just update the NSUserDefaults with the selected theme name in SelectThemesTableViewController inside didSelectRow delegate method and when user will again tap on first tab just check the NSUserDefault value in viewWillAppear method of TimelineTableViewController and update the UI as per the value.
// .h
@interface SelectThemesTableViewController : UITableViewController
@property (nonatomic, strong) NSString *selectedTheme;
@end
// .m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
self.selectedTheme = selectedCell.textLabel.text;
[[NSUserDefaults standardUserDefaults] setObject:self.selectedTheme forKey:@"Theme"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"The value of the selected cell is %@", self.selectedTheme);
}
------------------------------------------------------------------------------------
// .h
@property (nonatomic, strong) NSString *selectedTheme;
// .m
@interface TimelineTableViewController () <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, NSFetchedResultsControllerDelegate>
@end
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.selectedTheme = [[NSUserDefaults standardUserDefaults] objectForKey:@"Theme"];
NSLog(@"What is this value %@", self.selectedTheme);
if ([self.selectedTheme isEqualToString:@"Black"])
{
NSLog(@"The value is %@", self.selectedTheme);
}
else
{
NSLog(@"Nope");
}
}