ios - UICollectionViewCells not appearing in a UICollectionView -


as title suggests have uicollectionview hooked uiviewcontroller through ib. have uicollectionview subclass called imagecell. in viewcontroller viewdidload method, register class this:

cgrect collectionviewrect = cgrectmake(384, 60, 728, 924); uicollectionviewflowlayout *flow = [[uicollectionviewflowlayout alloc] init]; imagecollectionview = [[uicollectionview alloc] initwithframe:collectionviewrect collectionviewlayout:flow]; [imagecollectionview registerclass:[imagecell class] forcellwithreuseidentifier:@"cell"]; imagecollectionview.delegate = self; imagecollectionview.datasource = self; 

i call method called getphotos in viewdidappear (for ui reasons) gets photos service , call [imagccollectionview reloaddata]; inside getphotos.

then in cellforitematindexpath following:

imagecell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; grkalbum *album = [albums objectatindex:indexpath.item]; cell.titlelabel.text = album.name; return cell; 

i know not doing wrong here because method being called , cell not nil , neither album.

so, when run of code, uicollectionview appears, nothing in it. can see background color of collectionview. @ appreciated.

note: did not create xib imagecell class when made , using storyboards.

there ways debug situation.

  1. register uicollectionviewcell class instead of customcell , set cell's background color in cellforitem...

  2. if cells appearing in step 1 try use own cell class , set background

are using storyboard? then..

you dont have register cell collection view. can use prototype cell, give proper id cell.you can design in prototype cell. custom class may not needed in cases.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -