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:
- I have two views with tables, DoubleTable and SingleTable.
- SingleTable, surprise surprise, only has one table, whereas DoubleTable has two.
- SingleTable does not have the problem I described above.
- The tables in DoubleTable are resized programmatically in viewDidAppear. The table in SingleTable is not resized programatically.
- Changing the storyboard in DoubleTable does not seem to affect how the tables get resized when I slide the menu out.
- Rather, it seems as though the programatic resize is getting undone as though it never happened when I open the slide menu.
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.