iOS 键盘的关闭

iOS 键盘的关闭

//通过委托来放弃 “第一响应者”
#pragma mark - UITextField Delegate Method
-(BOOL)textFieldShouldReturn:(UITextField*)textField
{
    [textField resignFirstResponder];
    return YES;
}
//通过委托来放弃 “第一响应者”
#pragma mark - UITextView Delegate Method
-(BOOL)textview:(UITextView *)textView shouldChangeTextInRange:
(NSRange)range replacementText:(NSString *)text
{
    if([text isEqualToString:@"\n"]){
        [textView resignFirstResponder];
        return NO;
    }
    return YES;
    
}

 

posted @ 2014-11-15 13:39  Rui.peng  阅读(190)  评论(0编辑  收藏  举报