1. UITextFieldDelegate的代理
10年積累的網(wǎng)站制作、網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有城子河免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
開(kāi)始輸入的監(jiān)聽(tīng):
// return NO to disallow editing.
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;
輸入結(jié)束的監(jiān)聽(tīng):
- (void)textFieldDidEndEditing:(UITextField *)textField;
等等。在這些方法中,添加相應(yīng)的操作。
2.獲取UITextField輸入內(nèi)容
[self.accountText addTarget:self action:@selector(input:) forControlEvents:UIControlEventEditingChanged];
- (void) input:(UITextField*)textField {
}
3.監(jiān)聽(tīng)鍵盤(pán)事件的通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardShow:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardHide:)
name:UIKeyboardDidHideNotification
object:nil];
- (void)keyboardWillShow:(NSNotification *)notif {
}
- (void)keyboardShow:(NSNotification *)notif {
}
- (void)keyboardWillHide:(NSNotification *)notif {
}
- (void)keyboardHide:(NSNotification *)notif {
}