ios - UILabel in custom UICollectionViewCell always null, can't update text -


i created collection view simple apple collection view sample project. have collection view in view controller in storyboard, , set label inside collection view cell in top right part of collection view. i've hooked iboutlet in custom cell. here's relevant code:

- (void)viewdidload {     [super viewdidload];     [self.workoutview registerclass:[cell class] forcellwithreuseidentifier:@"cell"];     ... }  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     if (collectionview == self.collview) {         cell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath];             cell.segmenttitle.text = @"some text";         cell.backgroundcolor = [uicolor whitecolor];         return cell;     }     return nil; } 

i put breakpoint after segmenttitle.text part , segmenttitle null. accordingly see in simulator empty white boxes. did miss?

uicollectionviewcell inside storyboard don't need registerclass, choose reuseidentifier in storyboard. delete line:

   // [self.workoutview registerclass:[cell class] forcellwithreuseidentifier:@"cell"]; 

and make sure connect right way:

-select class type of uicollectionviewcell in storyboard cell

-drag uilabel cell , hook cell.h

-type reuse identifier


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -