I have a problem with an animation. The problem is that if I try to animate a view that is already created all goes well, if I try to create and animate a view at the same time the animation doesn't work.
Can anyone help me?
My Methods
+ (LoginView *)sharedInstance {
@synchronized(self) {
if (nil == _sharedInstance) {
_sharedInstance = (LoginView *)[[[NSBundle mainBundle] loadNibNamed:@"LoginView" owner:nil options:nil] objectAtIndex:0];
}
}
return _sharedInstance;
}
- (void)hide:(BOOL)value animated:(BOOL)animated {
CATransition * animation = [CATransition animation];
animation.type = kCATransitionFade;
[animation setDuration:1.0];
if(_autoManageModalView)
[animation setDelegate:self];
[[self layer] removeAllAnimations];
[[self layer] addAnimation:animation forKey:kCATransition];
self.hidden = value;
}
How I call them
[[LoginView sharedInstance] hide:NO animated:YES];
The first time (with the same call) animation doesn't work, from the secondo time all goes well. Thank in advance!