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
Robert Conti
23,274 PointsBlog Reader App: Why is the first cell of Table View behind iPhone top status bar (Carrier, signal, battery indicator)?
When restarting this project from scratch, following the instruction in the video, the Table View seems to show up behind the iPhone top status bar where the Carrier, signal and battery indicators are. Looks like there should be a top margin, but how/where is that set?
1 Answer
Stone Preston
42,016 Pointssince 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.
Robert Conti
23,274 PointsRobert Conti
23,274 PointsThanks Stone! Tried both options and both worked perfectly. Is one considered 'better practice' than the other? When scrolling through a list of cells the same issue will arise, text behind the time, battery indicatory, etc. Can we remedy this with a solid background color or is there an option to check/uncheck?
Robert Conti
23,274 PointsRobert Conti
23,274 PointsNevermind, my questions were answered further along in the project. Thanks again Stone!