0

I'm fairly new to UICollectionView. Though I've watched the WWDC talks on it I'm still unclear how to achieve my layout. I'm trying to constrain my flow layout to a square bottom aligned to the window's rootviewcontroller (see image). However, when setting UIEdgeInsetsMake(200, 10, 10, 10) which as I understand should compress only the top portion of the flow layout, instead what happens is the flow layout is compressed from top and bottom. Additionally, I'm not sure how to use -(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect or -(CGSize)collectionViewContentSize to create this layout.

-(id)init
{
    self = [super init];
    if (self) {
        self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        self.itemSize = CGSizeMake(75, 75);
        self.sectionInset = UIEdgeInsetsMake(100, 10, 10, 10);
    }
    return self;
}

What my results are: enter image description here

What I'm trying to acheive: enter image description here

Pouria Almassi
  • 1,580
  • 2
  • 17
  • 26
  • 1
    Why not just make the frame of the collection view itself look like the image of what you're trying to achieve? Currently, is the frame of the collection view the size of the entire controller's view? – rdelmar May 08 '13 at 16:22

1 Answers1

0

I think the frame of collection view is different from what you need .Set it properly

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
  • specifically? could you point me to some documentation? UIEdgeInsetsMake seems like it should be all I need but this doesnt appear to be the case in practice. – Pouria Almassi May 10 '13 at 17:47