small medium large xlarge

24 Jun 2008, 21:38
Clint Shryock (6 posts)

on page 46 of the pdf, in file @CustomAnimationTiming/MyView.m@, function @move@, we create an NSDictionary and set it as the custom animation for object @mover@’s frameOrigin key. in previous examples we did this once in @initWithFrame:@, but in this example, aren’t we creating this dictionary and adding it each time the @move@ function is called?

- (void)move {
  NSDictionary *animations = [NSDictionary 
                              dictionaryWithObject:[self moveAnimation]
  [mover setAnimations:animations];
  NSPoint origin = [mover frame].origin;
  origin.x += mover.frame.size.width * 0.5;
  [[mover animator] setFrameOrigin:origin];


25 Jun 2008, 17:07
Bill Dudney (917 posts)

Hey Clint,

Yes we are creating a new dictionary with each call to move. While that does not hurt anything, it does not help either. I think I will rework that code so that it only gets added once.

Thanks for the comment!


You must be logged in to comment