Reputation: 65
can someone help me please..by telling ..how to transfer the array of images from one viewcontroller to another viewcontroller..after it how to access these images in cell containing imageview in CollectionView.. i already tried the following codes..
code for assigning arrays-
SICollectionViewController *sivc=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"savedImgCVC"];
sivc.savedImages=assetGroups;
code for accessing images..
UIImageView *picImageView = (UIImageView *)[cell viewWithTag:1];
picImageView.image = [UIImage imageNamed:[savedImages objectAtIndex:indexPath.row]];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"6"]];
..any help will be appreciated..thank you:)
Upvotes: 0
Views: 52
Reputation: 9768
You need to implement prepareForSegue:Sender:
- (void)prepareForSegue:(UIStoryboardSegue *)segue
sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"mySegue"])
{
SICollectionViewController *sivc = [segue destinationViewController];
sivc.savedImages=assetGroups;
}
}
Replace "mySegue" with name of your segue, in interface builder.
Hope it helps!
Upvotes: 1