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.

iOS Build a Blog Reader iPhone App Rebuilding from Scratch Adding a Table View Controller Class

Anuj Verma
Anuj Verma
11,825 Points

TableView displayed under Status Bar

I have successfully run this section and this may be an issue of iOS6 and iOS7, but when I run the build (with iOS7) the TableView is displayed under the Status Bar (where the time is displayed) and there is text collision. Wondering if there is an easy way to solve this. Thanks :)

3 Answers

Stone Preston
Stone Preston
42,016 Points

you can add a a header view to your tableView in the viewDidLoad method of your tableViewController programatically

UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(XXX, YYY, XXX, YYY)];
self.tableView.tableHeaderView = headerView;

or you can do it in storyboard by simply dragging a UIView to the top of your tableView and dropping it in place, then size it to the height you want it

Anuj Verma
Anuj Verma
11,825 Points

I put the below and it worked, but seems like there has to be a checkbox within Attributes inspector for this.

   UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
    self.tableView.tableHeaderView = headerView;
Anuj Verma
Anuj Verma
11,825 Points

Just seems strange that the solution to this is to create UIView so that the tableview is correctly aligned with the status bar. Feels like something that should be aligned without having to do that step.

Stone Preston
Stone Preston
42,016 Points

ahh yeah. well it used to be like that but in ios7 apple made the status bar transparent which causes these problems.

Anuj Verma
Anuj Verma
11,825 Points

ah right! got it. cool thanks for your help :). it was a small problem but was really bothering me!

Anuj Verma
Anuj Verma
11,825 Points

Ignore, accidentally posted response in wrong section.