Backspace in UITextView substringToIndex , app is crashing .
Posted
by user271753
on Stack Overflow
See other posts from Stack Overflow
or by user271753
Published on 2010-03-27T08:01:49Z
Indexed on
2010/03/27
8:03 UTC
Read the original article
Hit count: 313
Hey Guys check this code ( My Custom Keyboard) :
-(IBAction) updateTextBackSpace:(id)sender
{
if([txtview.text length]>0)
{
NSString *deletedLastCharString = [txtview.text substringToIndex:([txtview.text length]-1)];
[txtview setText:deletedLastCharString];
}
else
{
NSLog("End");
}
I am able to erase the letters ( backspace ) but after the first letter is erased and if I press backspace one more time then the application crashes .. AND the main thing is that I can't figure out how to change this code so that , I can erase any text in any give line at the cursor, the backspace starts to erase from end of the line . Please Help
© Stack Overflow or respective owner