在中使用Secure Text Entry
時,如果我輸入了文本,轉到另一個文本字段並返回並開始寫入而沒有按回,文本將被覆蓋。檢測UITextField安全文本輸入覆蓋的文本
現在,進出口使用下面的跟蹤輸入的文字:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSString *text = [textField.text stringByReplacingCharactersInRange:range withString:string];
}
但在上述情況下,事件犯規跟蹤文本字段已這樣清除我不能總是依賴於字符串text
任何好的提示?
當你在文本框始終輸入文本時明確文本框。 – iOS
嘗試使用 清除文本字段 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; – iOS
@Darji我正在使用'安全文本輸入',它將隱藏我的文本爲默認。 – Nam