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


Rycardo C
Rycardo C
4,599 Points

The BlogReader is covering Status Bar


When I create the TableViewController, the Status Bar in the simulator is being covered. Is there a way to make it so this does not happen?

Status Bar is where Carrier, Wi-Fi Signal, Time, Battery, etc are displayed.



3 Answers

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

You can add a table header view which will create some space between the top edge of the screen and the table view.

Add the following code to your viewDidLoad method:

self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];

Got same problems. and adding this code somewhat helps on iOS7, but also makes thing ugly in iOS6

Got a working workaround. In viewDidLoad

you need to insert Amit's provided code between if statement, where you check if your iOS version is 7.0 or greater. So it looks like this:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f){
   self.tableView.tableHeaderView = [[UIView alloc] 
      initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)];

This Helps to not mess with iOS 6

Brett Kim
Brett Kim
11,576 Points

Nice! Super useful.