ios - How to use custom UICollectionViewCell within Storyboard? -


i don't understand why custom cell not recognised in storyboard.

tntopstoriescollectionviewcontroller:

static nsstring * const reuseidentifier = @"tntopnewscellitem";  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     tntopstoriescollectionviewcell *cell = (tntopstoriescollectionviewcell*)[collectionview dequeuereusablecellwithreuseidentifier:reuseidentifier forindexpath:indexpath];     // configure cell     [self preloadimagesforcategory:_datastore.fivetopstories[indexpath.item] andimageview:cell.itemimage];     return cell; } 

i'm using storyboard collectionview: enter image description here

and cell correctly pointing custom class: enter image description here

#import <uikit/uikit.h>  @interface tntopstoriescollectionviewcell : uicollectionviewcell @property (weak, nonatomic) iboutlet uiimageview *itemimage; @property (weak, nonatomic) iboutlet uilabel *title;  @end 

and correct cell identifier used: enter image description here

and yet exception within cellforitematindexpath method:

[uicollectionviewcell itemimage]: unrecognized selector sent instance 

but why please?

update:

i did suggested , getting this: enter image description here

however still fails @ same spot. :(

the fact cell called "collection view cell" on left, in hierarchical name listing of objects in scene, , has not changed "top stories collection view cell" suggests have not changed class in storyboard tntopstoriescollectionviewcell successfully.

(notice how collection view controller listed on left top stories collection view controller. same kind of thing should have happened cell.)

what see on left should more this:

enter image description here

(also, fact label outlet called news label on left suggestive of problem, since in code label called "title", , if you've hooked correctly i'd expect xcode have changed name "title" in listing on left well.)

[i have vague feeling may have 2 classes, tntopstoriescollectionviewcell , tntopnewscellitem, , you've confused them...]


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -