Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView adding UICollectionCell

When I try to put UICollectionCell to UICollectionView in Interface Builder I can't put it with unknown reasons. The cell is going to the tools bar without adding to UICollectionView

I am using:

  • iOS SDK 6.0
  • XCode 4.5.1
  • I don't use Storyboard
like image 713
Matrosov Oleksandr Avatar asked Mar 03 '13 10:03

Matrosov Oleksandr


People also ask

How do I add a cell to collection view?

Select The Collection View and go the Size inspector. In the Collection View section change the Cell Size to a width and height of 100 points. Drag a Label from the Object Library and place it on the Center of the Collection View Cell.


1 Answers

Only UICollectionView inside StoryBoard have UICollectionViewCell inside. If use XIB, create a new XIB with CellName.xib, add CollectionViewCell to it, specify name of UICollectionView custom class. After that use registerNib.

Sample code: https://github.com/lequysang/TestCollectionViewWithXIB

like image 71
LE SANG Avatar answered Sep 20 '22 02:09

LE SANG