small medium large xlarge

Generic-user-small
28 Jun 2008, 18:58
Adam Venturella (4 posts)

In 2.2 Smooth Moves

-(void) move { … }

targetFramePosition is a new value, but it is never declared.

- (void)move { 
if(isRight) { 
targetFramePosition = leftFramePosition; 
} else { 
targetFramePosition = rightFramePosition; 
} 
[[mover animator] setFrame:targetFramePosition]; 
isRight = !isRight; 
} 

</code>

Suggestion:

- (void)move {
// Add this line for clarity.
NSRect targetFramePosition;
 
if(isRight) { 
targetFramePosition = leftFramePosition; 
} else { 
targetFramePosition = rightFramePosition; 
} 
[[mover animator] setFrame:targetFramePosition]; 
isRight = !isRight; 
} 

</code>

You must be logged in to comment