Home Ask Login Register

Developers Planet

Your answer is one click away!

Red Mak February 2016

UICollectionView fixed Content Size

I'm trying to create a keyBoard extension using UICollectionView (i try to use UIButtons but the keyBoard take long time to load so i'm trying to use collection view maybe it will be better).

My questions are:

  1. what is better: to have a better responsiveness, should i use xib or code ?
  2. My principle issue is that i can't fix the content size of the collectionView layout so i can't fix the height of cell (direction == UICollectionViewScrollDirectionVertical)

here's how i'm trying to fix the cell height:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
       return CGSizeMake(self.keyBoardCollectionView.frame.size.width/Keys_In_section.count, self.keyBoardCollectionView.frame.size.height/sections.count);

using this code the width is correct but not the height (this is cause direction == UICollectionViewScrollDirectionVertical)


PhaniRaghu February 2016

for your first question both gives same responsiveness, but if you use storyboard designing will be easy.

for second one


just go through this link. it may helps you.

Post Status

Asked in February 2016
Viewed 3,492 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life