title: UICollectionView : animation custom layout
body: <p>I'm displaying lots of image cells in an UICollectionView.
  With one button I would like to be able to group all my cell over the first one.</p>
  
  <p>This is working well but when I'm trying to add an animation transition to my regroup action, nothing happens.</p>
  
  <p>Here the method I use in a custom layout :</p>
  
  <pre><code>- (NSArray*)layoutAttributesForElementsInRect:(CGRect)rect
  {
      NSArray* allAttributesInRect = [super layoutAttributesForElementsInRect:rect];
  
      if([allAttributesInRect count] &gt; 0 &amp;&amp; _isRegroup)
      {
          UICollectionViewLayoutAttributes *firstAttribute = [allAttributesInRect objectAtIndex:0];
          CGRect frame = firstAttribute.frame;
  
          for(UICollectionViewLayoutAttributes *attribute in allAttributesInRect)
              [UIView animateWithDuration:0.3f animations:^{attribute.frame = frame;}];
      }
      return allAttributesInRect;
  }
  
  - (void)regroupCells:(BOOL)isRegroup // This method is called from my collection controller when my button is pressed
  {
      _isRegroup = isRegroup;
      [self invalidateLayout];
  }
  </code></pre>
  
  <p>Any idea ?
  Thanks !</p>