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

Table View Cells aligned at (0,0) (ie above the "Carrier") in the iOS Simulator

For some reason my Table View Cells start at (0,0) in the iOS simulator, even though in the storyboard it looks good. Additionally, the view functionality in the Size Inspector seems to be disabled for the Table View Controller and I'd like to know why.

Here is a screen shot of both my storyboard and the simulator. http://bit.ly/1pGMJtG

Thanks!

2 Answers

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:

//tableViewController

-(void)viewDidLoad
{
     [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 Stone, you're the man. Adding an empty header did the trick!