Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't tell you why it does not work, but for me the subclass approach from this blog post solved the problem:</p> <p><a href="http://www.adoptioncurve.net/archives/2012/09/a-simple-uicollectionview-tutorial.php">http://www.adoptioncurve.net/archives/2012/09/a-simple-uicollectionview-tutorial.php</a></p> <p>here is a short summary:</p> <ul> <li>create a new class MyViewCell which extends UICollectionViewCell and create properties, actions, outlets and methods as needed.</li> </ul> <p><code>@interface MyViewCell : UICollectionViewCell</code></p> <ul> <li>create a View (xib file) with a Collection View Cell as its root object (and delete the object which is created by default).</li> <li>in the attributes set the custom class of this Collection View Cell to your extended class MyViewCell (instead of the default UICollectionViewCell).</li> <li>in the attributes under Collection Reusable View define an Identifier, e.g. myCell, you will need this later to register your call.</li> <li><p>go back to your custom class and modify the inithWithFrame method to load and use your created view.</p> <pre><code>- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"CVCell" owner:self options:nil]; if ([arrayOfViews count] &lt; 1) { return nil; } if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]]) { return nil; } self = [arrayOfViews objectAtIndex:0]; } return self; } </code></pre></li> <li><p>then you can register this class to be used by the collectionView with</p></li> </ul> <p><code>[self.collectionView registerClass:[MyViewCell class] forCellWithReuseIdentifier:@"myCell"];</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload