Вопрос

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?

Это было полезно?

Решение 3

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).

Другие советы

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);
    }
}

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;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top