Error setting text in collection view cell

前端 未结 1 1598
甜味超标
甜味超标 2020-12-07 00:27

when I nslog the value after setting it it is NULL, any word why?

CustomCollectionVIewCell *cell =[[CustomCollectionVIewCell alloc]init];
NSString *name =[di         


        
1条回答
  •  太阳男子
    2020-12-07 00:49

    init your labelDisplay in custom cell.

    //customColectionCell.h
    @property(strong,nonomatic) NSString *labelText;
    -(void)setCellLabelText:(NSString *)labelText;
    //customCollectionCell.m
    -(id)init{
    //init cellLabel and addSubView to customCell 
    
    }
    //Than set label in custom method
    -(void)setCellLabelText:(NSString *)labelText{
    _labelText = labelText;
    sefl.labelDisplay.text = labelText;
    }
    

    0 讨论(0)
提交回复
热议问题