如何停止键盘"发送"键盘隐藏的按钮?

时间:2017-04-16 20:25:04

标签: keyboard uitextfield xcode8 textfield

我使用Objective C

   -(void)textFieldDidBeginEditing:(UITextField *)textField    
 {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.3];
[UIView setAnimationBeginsFromCurrentState:TRUE];
self.chat.frame = CGRectMake(self.chat.frame.origin.x, self.chat.frame.origin.y -255., self.chat.frame.size.width, self.chat.frame.size.height);

 self.chit.frame = CGRectMake(self.chit.frame.origin.x, self.chit.frame.origin.y -255., self.chit.frame.size.width, self.chit.frame.size.height);

 self.button.frame = CGRectMake(self.button.frame.origin.x, self.button.frame.origin.y -255., self.button.frame.size.width, self.button.frame.size.height);

[UIView commitAnimations];
 }

 -(void)textFieldDidEndEditing:(UITextField *)textField  
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.3];
[UIView setAnimationBeginsFromCurrentState:TRUE];
self.chat.frame = CGRectMake(self.chat.frame.origin.x, self.chat.frame.origin.y +255., self.chat.frame.size.width, self.chat.frame.size.height);

self.chit.frame = CGRectMake(self.chit.frame.origin.x, self.chit.frame.origin.y +255., self.chit.frame.size.width, self.chit.frame.size.height);

 self.button.frame = CGRectMake(self.button.frame.origin.x, self.button.frame.origin.y +255., self.button.frame.size.width, self.button.frame.size.height);

[UIView commitAnimations];
}

每次单击UITextField时,此代码都会弹出键盘和UITextField。我还使用了ResignFirstResponder。

但是,我的键盘上有一个SEND按钮。当我点击SEND按钮时,键盘会退回。如何让SEND按钮停止隐藏键盘?

0 个答案:

没有答案