title: NSTextField custom background, border and corners
body: <p>I would like to draw my own TextField with 3 pictures.</p>
  
  <ol>
  <li>input_l.png - left side of the input</li>
  <li>input_m.png - middle part of the input - 1px wide - supposed to stretch or multiply to fill middle part</li>
  <li>input_r.png - right side</li>
  </ol>
  
  <p>All images contain border, background, shadows, just everything i need to draw it only with those pictures.</p>
  
  <p>But I cannot manage to draw it with subclass of NSTextField and these methods:</p>
  
  <pre><code>- (void)awakeFromNib
  {
      [self setDrawsBackground:NO];
  }
  
  - (void)drawRect:(NSRect)rect
  {
      NSDrawThreePartImage(rect, [NSImage imageNamed:@"input_l.png"], [NSImage imageNamed:@"input_m.png"], [NSImage imageNamed:@"input_r.png"], NO, NSCompositeSourceOut, 1.0, NO);
  
      [super drawRect:rect];
  }
  </code></pre>
  
  <p>It draws black background with text/placeholder.</p>
  
  <p>This is how it is supposed to look:
  <a href="http://d.pr/i/VLEN" rel="nofollow">http://d.pr/i/VLEN</a></p>
  
  <p>If there are any other way, better, to draw this please tell me :) It just occured to me that I could use 1px wide background image without borders to draw this and in code make corners rounded and somehow draw even border. However I still would like to know how to do it the way I tried, for future use.</p>