I'm working with ECSlidingViewController. When I load my view, everything displays perfectly. When I slide the menu out for the first time after loading a view, the two tables in my view change their heights. The top table gets an extra (blank) row for some reason, and the bottom table becomes smaller.
As far as I can tell, no code in either MenuViewController.m or the DoubleTable.m that loads the main view runs when I slide the menu out.
I either need to prevent this resizing from occurring or I need to be able to correct it after the unwanted resize takes effect.
Here is my code for attaching the menu under viewDidLoad:
self.view.layer.shadowOpacity = 0.75f;
self.view.layer.shadowRadius = 10.0f;
self.view.layer.shadowColor = [UIColor blackColor].CGColor;
if(![self.slidingViewController.underLeftViewController isKindOfClass:[MenuViewController class]]) {
self.slidingViewController.underLeftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
}
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
Some information that might prove useful in uncovering the problem:
Here is how I am resizing tables in DoubleTable.m:
-(void)viewDidAppear:(BOOL)animated{
CGRect frame = table1.frame;
CGRect Rect= [[UIScreen mainScreen] bounds];
frame.size.height = table1.contentSize.height;
table1.frame = frame;
int table2Height = Rect.size.height - 150 - table1.frame.size.height;
table2.frame = CGRectMake(table2.frame.origin.x, table1.frame.origin.y + 30 + table1.frame.size.height, table2.frame.size.width, table2Height);
}
If there is any more code anyone feels I should post, please feel free to ask.
You probably need to do your layout in more than just viewDidAppear. Perhaps in layoutSubviews? If you have auto layout on in storyboard then it will be adding constraints for you which causes it to snap back whenever layout occurs. You could try turning this off as well, but you have to make sure you have no constraints or it turns back on.