ios - Animation doesn't work -
i have problem animation. problem if try animate view created goes well, if try create , animate view @ same time animation doesn't work.
can 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 call them
[[loginview sharedinstance] hide:no animated:yes]; the first time (with same call) animation doesn't work, secondo time goes well. thank in advance!
you animating view in lifecycle. in theory, create view, display somewhere (e.g., addsubview:), animate it.
it highly possible, though have not checked it, first time hide:animated: method called self.layer property null; in case, animation happen before view displayed, not see it.
all in all, first display view, call hide:animated: method on it.
after comment: try , call hide:animated: method through method like:
performselector:withobject:afterdelay: if specify 0.0 delay, queue call hide:animate: on main loop, processing related loadnibnamed: can happen , give view time set display correctly.
in order use performselector:withobject:afterdelay: need modify method signature takes 1 argument , must nsobject-derived type, not primitive type.
Comments
Post a Comment