title: Why isn't my custom implementation of UITextField not doing anything - MonoTouch
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12683853/subclassing-and-overriding-uitextfield-in-monotouch">Subclassing and overriding UITextField in Monotouch</a>  </p>
  </blockquote>
  
  
  
  <p>So, I am using MonoTouch and basically trying to convert a lot of Obj-C code to MonoTouch.  The problem is that MonoTouch isn't well documented for a lot of things (or at least I cannot find it).</p>
  
  <p>On my form (yeah, I call it a form still) I have a UITextField with Placeholder text.  It works beautifully until I specified the Custom Class which is CustomUITextField. (see below).</p>
  
  <p>The problem is that it my breakpoints are being hit when I load the screen that it's on.   But, nothing does anything.  No placeholder is even shown anymore even when I call base.DrawPlaceholder(rect); from the override method.  I would expect that by calling base.DrawPlaceholder(rect); that I would at least get the default functionality of showing the placeholder text (this works without using my custom class - tested).  </p>
  
  <p>If I continue to use this custom class but remove the override DrawPlaceholder method from my implementation, then the standard placeholder text displays fine.  How in the world is that any different than overriding DrawPlaceholder and then calling base.DrawPlaceholder(rect);.  It's the same thing.</p>
  
  <p>Does anyone have any idea what I am doing wrong here?  I am going crazy...</p>
  
  <pre><code>using System;
  using MonoTouch.UIKit;
  using MonoTouch.Foundation;
  using System.Drawing;
  
  namespace MyApp
  {
      [Register("CustomUITextField")]
      public class CustomUITextField:UITextField
      {
          public CustomUITextField () :base()
          {
  
          }
  
          public CustomUITextField (IntPtr handle) :base()
          {
              this.BackgroundColor=UIColor.Black;
          }
  
          public override void DrawPlaceholder (RectangleF rect)
          {       
              this.BackgroundColor=UIColor.Black;
              base.DrawPlaceholder(rect);
  
              //UIColor col = new UIColor(0,0,255,0);
              //col.SetFill();
              //this.DrawString ("Title",rect, this.Font);
          }
  
          public override void DidChange (NSKeyValueChange changeKind, NSIndexSet indexes, NSString forKey)
          {
  
              base.DidChange (changeKind, indexes, forKey);
          }
  
          public override void DidChangeValue (string forKey)
          {
              base.DidChangeValue (forKey);
              this.Text="";
          }
      }
  }
  </code></pre>