TextView backspace problem

Discussion in 'iOS Programming' started by andyiapan, Dec 2, 2010.

  1. andyiapan, Dec 2, 2010
    Last edited by a moderator: Dec 2, 2010

    andyiapan macrumors newbie

    Feb 28, 2010
    i design a button to give textview a newline~

    inputfield.text =   [inputfield.text stringByAppendingString:@"\n"];	
    if i want to design a backspace UIbutton~

    inputfield.text =   [inputfield.text stringByAppendingString:@"\b"];
    i can't get backspace from this kind of code.

    how can i input a backspace from pressing a UIbutton~~

    many thanks~
  2. ianray macrumors 6502

    Jun 22, 2010
    ...is a C escape code which corresponds to ASCII character 8.

    When used in a terminal (VT52 example) this particular code moves the cursor backwards. But, as you have noticed, that will not work in other environments -- including text fields.

    A better solution is to simply remove the last character from inputfield.text.

Share This Page