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 trialCorey Dutson
Courses Plus Student 3,193 PointsTableViewCell height
I notice in the video: https://teamtreehouse.com/library/enhance-a-weather-app-with-table-views/custom-table-view-cells/creating-a-custom-table-view-cell that we set the Table View Cell height to custom
and 64
, but we must also add tableView.rowHeight = 64
to actually cause it to change height.
Why is that? Do you need to do both to actually cause the change to take effect? if so, why?
1 Answer
Patrick Egan
3,634 PointsHi guys. I am no expert at this but I will try to explain what I think may be the answer.
You have two elements here. One is a table view and the other is a table view cell.
If you just increase the size of the cell it won't show because the underlying view (canvas) is smaller.
If you just increase the size of the table view then you will just have a skinny cell on top of the view.
So you have to increase the size of both of the elements to have the desired effect.
That being said, perhaps it was a bit confusing because he did the cell through the size inspector and the view programmatically when he could have done that that through the size inspector too.
Lesson learned here though, everything you do programmatically will override what is in the inspectors.
Hope I explained that well enough. Good luck. :)
Karl Metum
3,447 PointsKarl Metum
3,447 Points+1 I'm wondering the exact same thing. Why are we setting it to 64 in different places?