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

Taylor Mahony
Taylor Mahony
5,814 Points

BlogReader on iOS 7.1 doesn't leave space for the header.

Hey all,

I am working on the blogReader, and my view doesn't take into account space for the header (i.e. where the Carrier, Signal strength, time, battery, etc). I assume I change that in the TableView or the TableViewController, but I'm not sure how to do so.

Does anyone else have this, and know how to fix it?

Thanks!

2 Answers

Stone Preston
Stone Preston
42,016 Points

you can add a header view to your tableView with the following code

-(void)viewDidLoad
{
     // ...
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y,   self.tableView.frame.size.width, 20)];
     self.tableView.tableHeaderView = headerView;
     // ...
} 

stick that code in your tableViewControllers viewDidLoad method and see if it works

that will push your tableView down a bit, giving room for the status bar.

Taylor Mahony
Taylor Mahony
5,814 Points

That did it! Thanks Stone!

I've been diligent to follow along closely to the lecture. I wonder, is this something I missed, or are headers handled differently than they were when the lecture was recorded?

Thanks again.

Stone Preston
Stone Preston
42,016 Points

yes, in io7 6 when this video was made this did not occur. in io7 they changed the way the status bar works. it is now transparent and content floats under it