-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return true;
}
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
return false;
}
return true;
}
- (void)viewWillDisappear:(BOOL)animated{
// 注销键盘出现通知
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
//注销键盘隐藏通知
[[NSNotificationCenter defaultCenter]removeObserver:self name:UIKeyboardDidHideNotification object:nil];
[super viewWillDisappear:animated];
}
- (void)keyboradDidShow:(NSNotification*)notif{
}
- (void)keyboradDidHide:(NSNotification*)notif{
}
网友评论