2

I have a slide view controller setup.

When viewing the app in IOS7 the status bar is shown and translucent so it is shown with the content.

enter image description here

Is there something I should be doing to offset the content below the status bar for this specific View Controller in my storyboard?

StuartM
  • 6,743
  • 18
  • 84
  • 160

3 Answers3

2

Awarded answer to @Idan for the suggestion but as this is a table view controller had to accomplish differently:

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];

    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")) {
        self.tableView.frame = CGRectMake(0, 20, self.tableView.frame.size.width, self.tableView.frame.size.height-20);
    }
}
Idan
  • 9,880
  • 10
  • 47
  • 76
StuartM
  • 6,743
  • 18
  • 84
  • 160
2

I've solved it by introducing setting the table header view as a 20 point height view.

This code in viewDidLoad

UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, self.tableView.frame.size.width, 20.f)];
headerView.backgroundColor = [UIColor whiteColor];

self.tableView.tableHeaderView = headerView;
Fábio Oliveira
  • 2,346
  • 21
  • 30
1

Two different methods (depands on what you are trying to do):

  1. Add this value to plist: "View controller-based status bar appearance" and set it to "NO". then you can code whatever you want (setStatusBarHidden etc.)

  2. If you just want to move the view when it's iOS7 (status bar is above), in interface builder -> attribute inspector -> set delta y to -20 (so it would be below status bar).

Idan
  • 9,880
  • 10
  • 47
  • 76
  • Unfortunately I do not think it is that simple. I am using ECSlidingViewController as my sliding view controller. This means I have an initial view controller underneth which handles holding the other controllers. Then I have a main controller (loaded in the middle/main screen) then I have a left menu controller. I am happy to have the status bar on the main controller but the left menu controller I need to handle it differently so when the left controller is shown I would like to move the content down and possibly change the color of the status bar? – StuartM Sep 20 '13 at 08:22
  • Also, as it is a table view controller I do not have the ability to change the offset of the table. – StuartM Sep 20 '13 at 08:23
  • See full answer below – StuartM Sep 20 '13 at 10:56