I have code like this:
In .m
- (void)viewDidLoad
{
[super viewDidLoad];
arrReceipes = [[NSMutableArray alloc] init];
arrReceipesTime1 = [NSArray arrayWithObjects:@"Half an hour or less",@"About an hour",@"More than an hour", nil];
NSDictionary *arrReceipeTime1Dict = [NSDictionary dictionaryWithObject:arrReceipesTime1 forKey:@"Find Recipes"];
arrReciepHeart = [NSArray arrayWithObjects:@"HealthyAndDelicius", nil];
NSDictionary *arrRecipesHeartDict = [NSDictionary dictionaryWithObject:arrReciepHeart forKey:@"Find Recipes"];
arrRecipeLifestyle = [NSArray arrayWithObjects:@"Recipe for fall",@"Quick and easy",@"Cooking for kids",@"Easy entertaining",@"American classics", nil];
NSDictionary *arrRecipeLifestyleDict = [NSDictionary dictionaryWithObject:arrRecipeLifestyle forKey:@"Find Recipes"];
[arrReceipes addObject:arrReceipeTime1Dict];
[arrReceipes addObject:arrRecipesHeartDict];
[arrReceipes addObject:arrRecipeLifestyleDict];
}
Now, I want to pass values from “arrReceipes”(in which I’m doing “addObject:dictionaryObject“) to another view controller using segue(or any other way, if you know)
And using “segue” I’m doing it using following:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showRecipeDetail"]) {
NSIndexPath *indexPath = [self.tableView1 indexPathForSelectedRow];
RecipeDetailViewController *destViewController = segue.destinationViewController;
destViewController.recipeName = [arrReceipes objectAtIndex:indexPath.row];
}
}
I’m getting exception as my “arrReceipes” is NSMutableArray assigned with dictionary objects.Instade if taking “NSMutableArray“, if I’m using “NSArray” its working fine. But I want to use “NSMutableArray“; because with this I can make group in table view.
Probably you wanted
Which is the same as