I have NSMutableArray like following:
In .h
@property (nonatomic,retain) NSMutableArray *arrReceipes;
In .m
@synthesize arrReceipe;
Inside a method
arrReceipes = [[NSMutableArray alloc] init];
NSArray *arrReceipesTime1;
NSArray *arrReciepHeart;
NSArray *arrRecipeLifestyle;
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",@"Outdoor cooking", nil];
NSDictionary *arrRecipeLifestyleDict = [NSDictionary dictionaryWithObject:arrRecipeLifestyle forKey:@"Find Recipes"];
[arrReceipes addObject:arrReceipeTime1Dict];
[arrReceipes addObject:arrRecipesHeartDict];
[arrReceipes addObject:arrRecipeLifestyleDict];
That is "arrReceipes" is my NSMutable array.
Now I want to extract the value/string of "arrReceipes" and put it into "NSArray * somevariable".
How can I do this?
This I' doing for :
-(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];
}
}
In my 3rd line above(in 'if') if I'm giving "arrReceipes" its throwing exception in "main" method.But, if, instade of giving "arrReceipes" I'll give "somevariable" its working fine.
Hope you understand my problem.Please help.Thanks.