Q:

Segue from UICollectionViewCell to right place in a UIScrollView

I have some images in my UIScrollView, and I want that if I click on them, there will be a UIScrollView where I can scroll trough all my images (like in the Photo's app). I got this code:
CollectionViewController:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    //ImageDetailSegue
    if ([segue.identifier isEqualToString:@"ScrollView"]) {
        Cell *cell = (Cell *)sender;
        NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];

        int imageNumber = indexPath.row % 9;

        ScrollViewController *divc = (ScrollViewController *)[segue destinationViewController];
        divc.img = [UIImage imageNamed:[NSString stringWithFormat:@"full%d.png", imageNumber]];
    }
}

ScrollViewController:
for (int i = 1; i < 4; i++) {
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"full%d.png", i]]];

    image.frame = CGRectMake((i - 1) * 320, 0, 320, 240);
    [imageScroller addSubview:image];
}
imageScroller.contentSize = CGSizeMake(320 * 6, 240);

How can I connect these two?

A:

If your collection view has, say, 50 images and you click on #5, are you saying you want to see a scroll view, with the same 50 images, but starting at image #5? 
Basically, it's all a function of what the model is backing your UICollectionView controller. For example, let's say that the collection view has an array (perhaps an array of image names, perhaps an array of objects for which the image filename is one property), like so:
@property (nonatomic, strong) NSMutableArray *objects;

Then the second scene might have a property that mirrors that, like:
@property (nonatomic, weak) NSArray *objects;

That first property would be an immutable reference to the main view controller's array that backs its collection view. 
Your scroll view should also probably have some index property, so you can tell it which cell you selected:
@property (nonatomic) NSInteger index;

The second view controller can use this index property to figure out where to start its contentOffset.
And then the first controller's prepareForSegue would look much like you suggested:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"ScrollView"])
    {
        Cell *cell = (Cell *)sender;
        NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];

        ScrollViewController *divc = (ScrollViewController *)[segue destinationViewController];
        divc.objects = self.objects;
        divc.index = indexPath.item;
    }
}

Note, I would suggest that neither the collection view nor the scroll view maintain an array of images (because you can quickly run into memory problems). It's much better if it's an array of image names or image URLs. Then you can have cellForItemAtIndexPath retrieve the image, as needed, but you then enjoy the full memory efficiency of the collection view. And I'd suggest the scrollview employ a similar technique. (To make life easier on yourself, you might want to contemplate making this second scene a horizontal collection view (where each cell takes up the full screen, itself), or find yourself a good infinite scrolling scrollview class that handles its memory efficiently.)

