title: Save graphics context in NSGraphicsContext in order to redraw contents of view
body: <p>I am trying to save a graphics context and display it alongside new added drawings. It's not working for me.</p>
  
  <p>I'm doing this in a loop to draw out names on a custom <code>NSView</code>:</p>
  
  <pre><code>- (void)drawNamesQuarterFinals{
  
      self.drawStringWithAttributes = [self stringAttributes:0];
  
  
      if ([self.arrayWithQuarterFinals count] &gt; 4)
      {
          for (int i = 0;i &lt; 8;i++){
              self.stringToDraw = [NSString stringWithFormat:@"%@", [self.arrayWithQuarterFinals objectAtIndex:i]];
              self.whereToDrawString = [self namePositions:i rowNumber:0];
              [self setNeedsDisplay:YES];
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>This is my <code>drawRect:</code> method:</p>
  
  <pre><code>- (void)drawRect:(NSRect)dirtyRect
  {
  
      NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
  
      [self drawPlayField];
  
      [self.stringToDraw drawAtPoint:self.whereToDrawString withAttributes:self.drawStringWithAttributes];
      [NSGraphicsContext saveGraphicsState];
  
      [currentContext restoreGraphicsState];
  }
  </code></pre>
  
  <p>As you can see, I use a loop to draw out all the names, but only the last name is displayed in the <code>NSView</code>. The others get overwritten every time <code>drawRect:</code> is called. </p>
  
  <p>My question: How can I prevent this from happening? As you can see I've tried to add a<code>NSGraphicsContext</code> where I want to save my context to be redrawn, but this is not working. 
  I might be way off. Point me in the right direction please!</p>