osx - NSViewAnimations used in OS X 10.6 stopped working in OS X 10.9, subsequent animations aren't firing -
i wrote animation code in os x 10.6, animations aren't working when recompile app 10.9.
i've got array of buttons, each of them goal have shrink, return normal size, shrink, , return normal size (to "flex" couple of times).
nsmutablearray *animations = [nsmutablearray arraywithcapacity:buttons.count]; nsmutablearray *allanimations = [nsmutablearray arraywithcapacity:buttons.count*4]; for(nsbutton *button in buttons) { // store original frame , generate smaller frame nsrect originalframe = button.frame; nsrect smallframe = [self smallrectforrect:originalframe scale:0.9]; // build dictionaries describe animations normal-to-small , vice versa nsmutabledictionary *normaltosmall = [nsmutabledictionary dictionary]; [normaltosmall setobject:button forkey:nsviewanimationtargetkey]; [normaltosmall setobject:[nsvalue valuewithrect:originalframe] forkey:nsviewanimationstartframekey]; [normaltosmall setobject:[nsvalue valuewithrect:smallframe] forkey:nsviewanimationendframekey]; nsmutabledictionary *smalltonormal = [nsmutabledictionary dictionary]; [smalltonormal setobject:button forkey:nsviewanimationtargetkey]; [smalltonormal setobject:[nsvalue valuewithrect:smallframe] forkey:nsviewanimationstartframekey]; [smalltonormal setobject:[nsvalue valuewithrect:originalframe] forkey:nsviewanimationendframekey]; // create, , chain together, shrink, reset, shrink, reset animation chain nsviewanimation *animation1 = [self createanimationwithdictionary:normaltosmall duration:duration startingafteranimation:nil]; nsviewanimation *animation2 = [self createanimationwithdictionary:smalltonormal duration:duration startingafteranimation:animation1]; nsviewanimation *animation3 = [self createanimationwithdictionary:normaltosmall duration:duration startingafteranimation:animation2]; nsviewanimation *animation4 = [self createanimationwithdictionary:smalltonormal duration:duration startingafteranimation:animation3]; // store of animations in array in case arc wants release them prematurely. [allanimations addobjectsfromarray:@[animation1, animation2, animation3, animation4]]; // store first animation, can start each of chains after we're done creating them. [animations addobject:animation1]; } // start first animation in each chain (nsviewanimation *animation in animations) { [animation startanimation]; } here function used create each of animations:
- (nsviewanimation*) createanimationwithdictionary:(nsdictionary*)animationdictionary duration:(float)duration startingafteranimation:(nsviewanimation*)previousanimation { nsviewanimation *animation = [[nsviewanimation alloc] initwithviewanimations:[nsarray arraywithobject:animationdictionary]]; [animation setduration:duration]; [animation setdelegate:self]; if (previousanimation != nil) { [animation startwhenanimation:previousanimation reachesprogress:1.0]; } return animation; } i set window controller delegate watch animations start , end , appears first animation in each chain starts , ends. subsequent animations configured -startwhenanimation:reachesprogress:1.0 not appear start @ all.
why won't subsequent animations start running?
Comments
Post a Comment