6
我創建了一個自定義的退格鍵,但我的問題是我的後退按鈕很好,爲了從字中間刪除字符,但刪除後1個字符(刪除字母),回到行尾這意味着不留光標所在,這裏是我的代碼:刪除字符的按鈕
NSRange deleteRange = textPad.selectedRange;
if (deleteRange.length >0)
textPad.text = [textPad.text stringByReplacingCharactersInRange:deleteRange withString:@""];
else
if (deleteRange.location > 0)
textPad.text = [textPad.text stringByReplacingCharactersInRange:NSMakeRange(deleteRange.location-1,1)
withString:@""];
看起來像你自己找到它無論如何:) – Daniel 2010-10-28 20:06:50
是的,謝謝你:) – Momi 2010-10-28 20:08:22