0

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:)

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.