With the following code, I send data to a view controller, which then retrieves another set of data based on the ID variable that I send.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *dict = [rows objectAtIndex: indexPath.row];
ListingsViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"tabView"];
controller.SUBSUBCATNAME = [dict objectForKey:@"S_NAME_EN"];
controller.SUBSUBCATNUMBER = [dict objectForKey:@"SUBCAT_ID"];
[self.navigationController pushViewController:controller animated:YES];
}
The next view loads another table that lists hotels in a country. What I want to do is to put a tabview in between and filter hotels with the help of tabs. Forexample, the first tab will display all hotels, the second tab will display hotels in one region, the third tab another region and so on.
My problem is when I send SUBSUBCATNUMBER to tabbarcontroller, it throws an error:
'NSInvalidArgumentException', reason: '-[tabView setSUBSUBCATNUMBER:]: unrecognized selector sent to instance
How can I send this ID to the tabbarcontroller which loads my view controller that lists all listings in that ID’s category.
You’re breaking the naming rules, which is why it’s failing. Your ivar names should begin with a lowercase letter, so it should be called subSubCatNumber, or any other name, that begins with a lower case letter. Change SUBSUBCATNUMBER to the above, or even sUBSUBCATNUMBER if you wish, but make the first letter lower case. Only leave it capitalized if you explicitly call setSUBSUBCATNUMBER somewhere.