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 trialNitin Eusebius
2,738 PointsBlog reader app - Table cells touching the header
Hi - I am working on the IOS7 and when I run the table view, the cell starts with on the top. Touching the top of the simulator. Is anyone facing same issue?
6 Answers
Thomas Nilsen
14,957 PointsOr you could do something like this:
NSInteger cellCount = [self tableView:tableView numberOfRowsInSection:indexPath.section];
return self.view.frame.size.height / (CGFloat)cellCount;
That is what you put inside of the delegate method
Amit Bijlani
Treehouse Guest TeacherI've answered this here: https://teamtreehouse.com/forum/the-status-bar-is-in-the-way
Thomas Nilsen
14,957 PointsYou need to implement
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
}
It's one of the tableView's delegates .
Nitin Eusebius
2,738 PointsHi Thomas,
Thanks. I am pretty new to IOS dev. What kind of code would go into this
Thanks, Nitin
Thomas Nilsen
14,957 PointsThe function returns a float. So If you were to write "return 60.0f" (Try it out), that would happen to all the cells. What you need to do, is locate the first cell and set the approriate height :)
Nitin Eusebius
2,738 Pointscool thanks this work. I was wondering that is this a bug or a feature that came with IOS 7 and X5? It was not the case previously