Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Temperature labels not showing in cells

No errors, but label is not showing in table cell. I have my outlet defined in my custom cell as "maxlabel" and the cell code is as follows:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! DailyWeatherTableViewCell

        cell.maxlabel.text = maxarray[indexPath.row] as? String


        return cell
    }

Your code looks right, so let's try a view things:

  • As your app does not crash, maxarray should return a valid string. To be a 100% sure, though, let's try cell.maxlabel.text = "Test". Is the label still empty?
  • Have you set your auto layout constraints correctly? Are you using size classes? Chances are your label is off-screen for some reason.

Let me know if that helps!

Martin, I changed the array to "test" and used the Center Vertically Constraint and the word "Test" was all the way to the left of the screen barely visible. How do I get the label to show on the right side of the cell?