Note that there are some explanatory texts on larger screens.

plurals
  1. POCells are hidden using CollectionView
    primarykey
    data
    text
    <p>I have a Navigation Controller pushing to a Collection View Controller. This collectionView has an <code>NSArray</code> of images, and I'm sure there are some elements in the collectionView using the method visibleCells. But when I launch it there is no displaying cells. Here is my code :</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; images = [NSArray arrayWithObjects:@"angry_birds_cake.jpg", @"creme_brelee.jpg", @"egg_benedict.jpg", @"full_breakfast.jpg", @"green_tea.jpg", @"ham_and_cheese_panini.jpg", @"ham_and_egg_sandwich.jpg", @"hamburger.jpg", @"instant_noodle_with_egg.jpg", @"japanese_noodle_with_pork.jpg", @"mushroom_risotto.jpg", @"noodle_with_bbq_pork.jpg", @"starbucks_coffee.jpg", @"thai_shrimp_cake.jpg", @"vegetable_curry.jpg", @"white_chocolate_donut.jpg", nil]; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return images.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ static NSString *identifier = @"Cell"; UICollectionViewCell *cell; [collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; NSArray *tab = [collectionView visibleCells]; for (int i = 0; i &lt; [tab count]; ++i) { NSLog(@"%d", i); } [collectionView setBackgroundColor:[UIColor blueColor]]; UIImageView *imageView = (UIImageView *)[cell viewWithTag:100]; imageView.image = [UIImage imageNamed:[images objectAtIndex:indexPath.row]]; return cell; } </code></pre> <p>Where am I wrong ? Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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