天天看點

keyboard ios 虛拟鍵盤 删除鍵的響應

uitextview 的處理
           
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
           
{
    if([text length] != 0) //點選了非删除鍵
    {
    }
    else
    {
        text ; // 按鍵對應的str
    }
}
           

UITextField 的處理

- (BOOL)textFieldShouldClear:(UITextField *)textField;               // called when clear button pressed. return NO to ignore (no notifications)
- (BOOL)textFieldShouldReturn:(UITextField *)textField;              // called when 'return' key pressed. return NO to ignore.