Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Status bar overwritten by TableView in iOS blog app

The status bar is written over by TableView in the iOS blog. It looks like a printing error in the simulator. I tried it on an iPhone 6+ with iOS 8.0.2 and see the same problem.

What is the proper way to handle the status bar in iOS 8 ?

Thanks in advance...

3 Answers

Stone Preston
Stone Preston
42,016 Points

since the status bar is transparent in iOS7+ views slide up underneath it. you can add an empty tableHeaderView the same height as the status bar to push the tableView down underneath the status bar like so:


     [super viewDidLoad];
     UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)];

     self.tableView.tableHeaderView = headerView;

     // ...

another option is to embed your view controller in a navigation controller by selecting your tableViewController and then selecting editor -> embed in -> navigation controller from the xcode menu. then select the new navigation controller and uncheck shows navigation bar in the attributes inspector.

Thanks for your response but the status bar is now white. It has pushed the table down but the status bar rectangle is blank.

Stone Preston
Stone Preston
42,016 Points

can you post a screen shot of what you are seeing without the above code, and what you see with it

Initially when I ran it, it didn't work... But tried it on the iPhone 6+ and then back on the simulator and it does display the status bar... thanks

alt text