I have a UICollectionViewController and my custom cells, and in my method cellForRowAtIndexPath: I set the cells based on indexPath.row. But I get the wrong results, this cell appears even after the first position, and if you scroll back and forth, it appears in random places. How to fix it?
Here is the code:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { DVGCollectionViewCell *cell; cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; if (indexPath.row == 0) { cell.imageView.image = [UIImage imageNamed:@"something1.png"]; cell.buyLabel.text = @"170"; cell.textLabel.text = @"11.2011"; } return cell; }
Dvole source share