views:

62

answers:

1

now sometimes things just don't work as expected.

my UIView has a method to add itself to a given parent view like this

-(void)showPanelInView:(UIView*)view
{
 self.hidden = YES;
 [view addSubview:self];

 [UIView beginAnimations:@"categories_panel" context:NULL]; 
 [UIView setAnimationBeginsFromCurrentState:YES];
 [UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView:self cache:NO]; 

 [UIView setAnimationDuration:0.4];

 self.hidden = NO;

 [UIView commitAnimations];

}

but it just appears with no animation whatsoever, similar method to remove itself from the parent looks just fine, can't get my head around this one ...

Anybody sees where's the problem?

The only thing I can think about is that addSubview actually doesn't do much when the subview is hidden ... or?

A: 
[UIView setAnimationTransition:... forView:self cache:NO]; 

The transition should be applied to the unchanged view that contains the change, i.e.

[UIView setAnimationTransition:... forView:view cache:YES]; 
KennyTM
hidden is set before the animation start. Changing to NO or YES don't affect my problem. From the dev docs about the cache param:If YES, the before and after images of view are rendered once and used to create the frames in the animation. Caching can improve performance but if you set this parameter to YES, you must not update the view or its subviews during the transition.
Ican Zilb
@Ican: The cache parameter isn't the only change...
KennyTM
sorry, didn't notice it was not the only change, you are right - I must've been blind :)
Ican Zilb