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!
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

Sean Lee
5,196 PointsBlogReader exercise, StoryBoard/TableView issue
Can someone tell me why my tableview is aligning everything to the top into the battery? When i run the app in my iPhone, the top gets cut off.
I followed the BlogReader exercise exactly but i'm still encountering this issue.
https://dl.dropboxusercontent.com/u/33810132/Pictures/blogReader.png
thanks!
2 Answers

Stone Preston
42,016 Pointsthats because the status bar is transparent in iOS 7. That didnt occur in the older versions of iOS when the video was made. To remedy this you can add a table header to your tableView by placing the following code in your viewDidLoad method:
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 20)];
self.tableView.tableHeaderView = headerView;
you can play around with the height of the header (its 20 currently) to get the positioning you want
if you dont like the tableHeader hack you could try adding this in viewDidLoad instead ( I havent tried it so I dont know if this works well or not)
self.tableView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);

Sean Lee
5,196 PointsBoth hacks work! thanks for the input, really appreciate it.