Search code examples
uitableviewios8contentoffset

after dismissing a viewController, the contentOffset from my tableView was changed to (0, -64)


The following code is not working.It makes tableview to move from (0,0) content offset to (0,-64) content offset.

-(BOOL)automaticallyAdjustsScrollViewInsets
{
    return NO;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.extendedLayoutIncludesOpaqueBars = NO;
}

This issue is in iOS8 only


Solution

  • self.navigationcontroller.navigationbar.transculent = NO;
    

    or

    [[UINavigationBar appearance]setTransculent:NO];
    

    we have to set either of the above statements to fix the tableview scroll issue.In xib we have to select navigation bar as infered and set the above appearance statement in AppDelegate.