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 trialAnuj Verma
11,825 PointsTableView 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
42,016 Pointsyou 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
11,825 PointsI 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;
Stone Preston
42,016 Pointswhat do you mean
Anuj Verma
11,825 PointsJust 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
42,016 Pointsahh yeah. well it used to be like that but in ios7 apple made the status bar transparent which causes these problems.
Anuj Verma
11,825 Pointsah right! got it. cool thanks for your help :). it was a small problem but was really bothering me!
Anuj Verma
11,825 PointsIgnore, accidentally posted response in wrong section.