undoManager = [self.window undoManager]
-(IBAction)wakeToRight:(id)sender
{
[self walkRight];
}
-(IBAction)wakeToLeft:(id)sender
{
[self walkLeft];
}
- (void) walkLeft
{
position = position + 10;
[[undoManager prepareWithInvocationTarget:self] walkRight];
[self showTheChangesToThePostion];
}
- (void) walkRight
{
position = position - 10;
[[undoManager prepareWithInvocationTarget:self] walkLeft];
[self showTheChangesToThePostion];
}
-(void)showTheChangesToThePostion
{
NSLog(@"position:%d",position);
}