title: How to simulate the delete key on UITextField?
body: <p>I'm creating an application on the iPad. I create a custom keyboard using <code>UITextField</code>'s <code>inputView</code> property. To insert text at the cursor position, I use the copy &amp; paste method (<a href="http://dev.ragfield.com/2009/09/insert-text-at-current-cursor-location.html" rel="noreferrer">http://dev.ragfield.com/2009/09/insert-text-at-current-cursor-location.html</a>), which works fine. Now, I want to create the delete key. The code that I'm using is:</p>
  
  <pre><code>if (textField.text.length &gt; 0) {
      textField.text = [textField.text substringToIndex:textField.text.length-1];
  }
  </code></pre>
  
  <p>However, as you may know, it only deletes the last character no matter where the cursor is. Does anyone know a better solution?</p>
  
  <p>Thank you very much!</p>