I have a CollectionViewController

- (void)viewDidLoad 
{
   [super viewDidLoad];    
   // assign layout (subclassed below)
   self.collectionView.collectionViewLayout = [[CustomCollectionLayout alloc] init];
}

// data source is working, here's what matters:
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
   ThumbCell *cell = (ThumbCell *)[cv dequeueReusableCellWithReuseIdentifier:@"ThumbCell" forIndexPath:indexPath];

   return cell;
}

I also have a UICollectionViewLayout subclass: CustomCollectionLayout.m

#pragma mark - Overriden methods
- (CGSize)collectionViewContentSize
{
    return CGSizeMake(320, 480);
}

- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
    return [[super layoutAttributesForElementsInRect:rect] mutableCopy];
}

- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
{
    // configure CellAttributes
    cellAttributes = [super layoutAttributesForItemAtIndexPath:indexPath];

    // random position
    int xRand = arc4random() % 320;
    int yRand = arc4random() % 460;
    cellAttributes.frame = CGRectMake(xRand, yRand, 150, 170);

    return cellAttributes;
}

I'm trying to use a new frame for the cell, just one at a random position. The problem is layoutAttributesForItemAtIndexPath is not called.

Thanks in advance for any advice.

Edit
Report