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

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.