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

Simple format error

Image

Does anyone know how I can fix this problem? The table view overlaps the status bar at the top, making it look very bad. Thank you!

2 Answers

Stone Preston
Stone Preston
42,016 Points

to fix this you can add a table header programatically

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

or using your storyboard. to do this using storyboard select your tableView controller and drag a view object from the utilities view onto the top part of your tableView and drop it in and adjust the view to the size you want it.

Where would I insert this code?

Stone Preston
Stone Preston
42,016 Points

viewDidLoad of your table view controller. You may have to play around with the header frame to Get the size you want, but the status bar is 20 high.