I want to add image from Gallery/Camera to NSMutableDictionary
& i am using following methods which i found Here
[dict setObject:UIImageJPEGRepresentation(chosenImage,0.5) forKey:@"image_four"];
[documents replaceObjectAtIndex:0 withObject:dict];
[tableOne reloadData];
In Cell for row at Indexpath
[cell.oneImgView setImage:[[UIImage alloc]initWithData:[dict objectForKey:@"image_four"]]];
I m adding NSMutableDictionary objects into one global array in ViewController A & Sending it to ViewController B where i add/update image from gallery/camera.
but when i press back button and go back UIViewController
A and then again go to view controller B those images are still in that array.
In short, whenever i add image to Array of UIViewController
B it some how affects to Array of UIViewController
A.
I want this to be done on Done button click but if i click on back button of navigation bar it does the same as Done button.
- (IBAction)goToBack:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
Can someone tell me where i m going wrong?
Finally, solved by copying objects of NSObject class & adding it array.
[[controllerb setDocuments1]addObjectsFromArray:array];