I have a custom view which I need to hide/unhide with animation. UIView animations are not working on hidden property.
So I have overridden setHidden where I modify the alpha with animation.
It works but while hiding it always seem to be slower than the rate at which it appears. I am giving 0.3 as duration but still disappearing happens slowly... and when it appears, its fast!
My Code
/* Will modify alpha instead of hidden var */
-(void)setHidden:(BOOL)hidden
{
[UIView animateWithDuration:0.5 animations:^{
self.alpha = hidden?0.0:1.0;
}];
}
/* need to override this so that, .hidden returns value based on alpha as we are not modifying the hidden ivar */
-(BOOL)isHidden
{
return (self.alpha == 0.0);
}