I have a UIViewController
holding UITableView
stretched on all it's area. On bar button click I'm trying to shrink and move and shrink the UITableView
to make a space for UIView
that is moving down from the top of the screen.
I attach thee project
I manage to move red view just fine, but having problems with moving and resizing UITableView stimulatenously.
Here are my animations that cause problems.
-(void)extendTableView
{
if (searchPanel) {
objectsTableView.frame = CGRectMake(objectsTableView.frame.origin.x, 0, objectsTableView.frame.size.width, 100);
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[animation setDelegate: self];
[animation setValue:ANIMATION_EXTEND_TABLE_VIEW forKey:KEY_ANIMATION];
[objectsTableView.layer addAnimation:animation forKey:ANIMATION_EXTEND_TABLE_VIEW];
}
-(void)shrinkTableView
{
if (searchPanel) {
objectsTableView.frame = CGRectMake(objectsTableView.frame.origin.x, 100, objectsTableView.frame.size.width, 100);
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromBottom];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[animation setDelegate: self];
[animation setValue:ANIMATION_SHRINK_TABLE_VIEW forKey:KEY_ANIMATION];
[objectsTableView.layer addAnimation:animation forKey:ANIMATION_SHRINK_TABLE_VIEW];
}
}
What would be the proper way to achieve that?