UILabel text not showing in UITableViewCell

Discussion in 'iOS Programming' started by moonman239, Aug 6, 2015.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    I have a prototype cell that contains a UILabel. I set the values of the UILabels of each cell that is created using this prototype in my view controller's cellForRowAtIndexPath method. When I run the app, there is just one cell (out of 3) that doesn't show any text. I checked the debugger and saw that the text property was set to a non-nil value.

    I must point out that I changed the maximum # of lines in the UILabel to 1, but that should have had no effect.

    I have done some research, and so far have only found threads that point to one of two causes - use of a worker thread to execute setText, and use of an incompatible font - but neither are what's causing my problem.

    Edit: I think I should point out that the label is linked to an IBOutlet named "textLabel".
     
  2. JWalker1995 macrumors regular

    Joined:
    Mar 5, 2011
    #2
    Have you set the number of rows in the table view delegate numberOfRowsInSection?

    In cellForRowAtIndexPath, are you creating the cell with cellWithIdentifier then editing the property of the cell or doing self.textLabel.text = myArray[indexPath.Row]
     
  3. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #3
    Did you set the proper class/identifier for the cell?
     
  4. rayenkamta macrumors newbie

    rayenkamta

    Joined:
    Aug 11, 2015

Share This Page