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:
and cell correctly pointing custom class:
#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:
and yet exception within cellforitematindexpath
method:
[uicollectionviewcell itemimage]: unrecognized selector sent instance
but why please?
update:
i did suggested , getting this:
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:
(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
Post a Comment