iOS 7 Table view fail to auto adjust content inset

前端 未结 7 1654
情话喂你
情话喂你 2020-12-04 14:24

I am transiting my project to iOS7. I am facing a strange problem related to the translucent navigation bar.

I have a view controller and it has a tableview as subv

7条回答
  •  青春惊慌失措
    2020-12-04 15:08

    Based on Tony's answer I was able to get around this problem programatically with temporarily sending the table view to the back, let the adjustments be made and then send the background view back to the back. In my case there is no flickering to this approach.

    In the View Controller:

    
    - (void)viewWillLayoutSubviews {
        [super viewWillLayoutSubviews];
    
        [self.view sendSubviewToBack:self.tableView];
    }
    
    - (void)viewDidLayoutSubviews {
        [super viewDidLayoutSubviews];
    
        [self.view sendSubviewToBack:self.backgroundView];
    }
    

    Obviously if there are other subviews on self.view you may need to re-order those too.

提交回复
热议问题