I have a UIView that serves as the container for 2 tableviews. I have two buttons that controls how data is loaded on those tableviews. Basically when 1 button is tapped the uiview slides out to show the tableview related to that button, and when the other button gets tapped I need it to:
- close
- hide the 1st tableview
- then unhides the 2nd tableview
- then uiview slides back out
Here's what I have
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
if(!isTableOpen){
[self.fighterTableView setHidden:YES];
[self.matchTableView setHidden:NO];
isTableOpen = YES;
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[self.view bringSubviewToFront:viewTableContainer];
[UIView commitAnimations];
}else{
//isTableOpen = NO;
viewTableContainer.frame = CGRectMake(-352, 0, 352, 700);
[UIView commitAnimations];
[self.fighterTableView setHidden:YES];
[self.matchTableView setHidden:NO];
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[UIView commitAnimations];
}
The problem here is on the commitanimations in the else statement I'm trying to set the hidden properties then pop the uiview out again. What's happening is it just hides and unhides the tableview but the animation never happens. I feel like I need to use a delay, but Idk how, unless there's a more decent way of handling this??
Thoughts?