title: Implementing NSUndoManager
body: <p>I'm having a hard time implementing the NSUndoManager, I tried reading the apple documentation on it, but I cant figure it out. This is what I have tried so far. I have created an app that draws lines by connecting two points in an array, I implemented an undo method by removing the last object, but cant figure out how to implement the redo, I stumbled upon NSUndoManager and started reading its documentation, but I dont know how to apply it to my issue. Heres the code that I have at the moment</p>
  
  <pre><code>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      NSUInteger taps = [[touches anyObject]tapCount];
      if(taps == 2) {
          [self setNeedsDisplay];
      }
      else {
          if([self.pointsArray count] == 0) {
              self.pointsArray = [[NSMutableArray alloc]init];
              UITouch *t = [touches anyObject];
              CGPoint startLoc = [t locationInView:self];
              [self.pointsArray addObject:[NSValue valueWithCGPoint:startLoc]];
          }
      }
  }
  
  -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
      UITouch *t = [touches anyObject];
      CGPoint currentLoc = [t locationInView:self];
      [self.pointsArray addObject:[NSValue valueWithCGPoint:currentLoc]];
      [self setNeedsDisplay];
  }
  
  #pragma mark - Undo/Redo Methods
  -(void)undo:(id) object {
      [[undoManager prepareWithInvocationTarget:self]redo:object];
      [undoManager setActionName:@"undoLineSegment"];
      [self.pointsArray removeLastObject];
  }
  
  -(void)redo:(id)object {
      [self.pointsArray addObject:object];
      [[undoManager prepareWithInvocationTarget:self]undo:object];
      [undoManager setActionName:@"RedoUndoneLineSegment"];
  }
  
  - (IBAction)undoButton:(UIButton *)sender {
      [self.undoManager undo];
      [self setNeedsDisplay];
  }
  
  - (IBAction)redoButton:(UIButton *)sender {
      [self.undoManager redo];
      [self setNeedsDisplay];
  }
  </code></pre>
  
  <p>I get no errors, but on runtime when I tap on the buttons, nothing happens. What I dont understand about NSUndoManager is where things go, what the "object" is. Am I not declaring something that I need to declare. </p>
  
  <p>Thanks, </p>