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 Build a Blog Reader iPhone App Getting Data from the Web What is NSDictionary?

TableView overlaps with top of screen

Hello Amit Bijlani Im doing the blogpost app but in my emulator my table view looks like this:

http://puu.sh/aI0Jt/216236f511.png

Any thoughts to fix that?

5 Answers

Never mind I had to add to that line with error (self.VIEW.frame) and now it works

So the line would be

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

All that inside - (void)viewDidLoad

And that would fix it

Thanks

I had the same issue. I initially hid the Status bar and then another Treehouser sent me this link to fix the issue. Here is the link:

https://developer.apple.com/library/ios/qa/qa1797/_index.html

Personally, I like the look better without the status bar and I use a ton of apps daily that hide it. You can hid the status bar by:

  1. go to your .plist file

  2. type "yes' in the "status bar is initially hidden" field,

  3. right-click anywhere and select "new row"

  4. scroll all the way to the bottom of the list and select "View controller-based status bar..." and make sure that it saids "no" in the last column.

Another fix I've found to work is to run the simulator. From the menu bar select IOS Simulator > reset contents and settings... Then rerun the app :)

Hope this helps!

That Apple link seems to have the answer but i just cant seem to find out how to use Auto Layout and apply a vertical spacing anchored to the "Top Layout Guide" of your view controller.

Hope Amit Bijlani help us out

Not sure if this will help, but I was having similar problems with the simulator. I restarted Xcode and it worked fine after that.

Here is a quick and easy fix: you can add a blank table header view to your tableView controller and it will push the table view down below the status bar.

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

May I know exactly where inside the controller and Im getting error in the word frame (in self.frame.size.width, 20), and im not sure whats the error

I think it is self.view.frame.size.width