Instead of making use of setHidden
method. Why don't you try using the setAlpha
method.
It will be something like this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
if(!isTableOpen){
[self.fighterTableView setAlpha:0.0];
[self.matchTableView setAlpha:1.0];
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 setAlpha:0.0];
[self.matchTableView setAlpha:1.0];
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[UIView commitAnimations];
}
I would suggest you perform
[UIView setAnimationDidStopSelector:@selector(myAnimationMethod)]
Instead of setting the alpha to 1.0 of the matchTableView set it inside the myAnimationMethod
.
So something like this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(myAnimationMethodDidFinish:)]
if(!isTableOpen){
[self.fighterTableView setAlpha:0.0];
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[self.view bringSubviewToFront:viewTableContainer];
[UIView commitAnimations];
}else{
//isTableOpen = NO;
viewTableContainer.frame = CGRectMake(-352, 0, 352, 700);
[self.fighterTableView setAlpha:0.0];
[UIView commitAnimations];
}
-(void) myAnimationMethodDidFinish:(id) sender {
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
if(!isTableOpen){
[self.matchTableView setAlpha:1.0];
isTableOpen = YES;
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[self.view bringSubviewToFront:viewTableContainer];
[UIView commitAnimations];
}else{
//isTableOpen = NO;
[self.matchTableView setAlpha:1.0];
viewTableContainer.frame = CGRectMake(0, 0, 352, 700);
[UIView commitAnimations];
}
}