收起键盘

#pragma mark UItextFieldDelegate

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField

{
    CGFloat height = self.view.frame.size.height;

    CGFloat offset = height - (_OtherTextField.frame.origin.y + _OtherTextField.frame.size.height + 216+100);

    if (offset<=0) {

        [UIView animateWithDuration:0.3 animations:^{

            CGRect frame = self.view.frame;

            frame.origin.y = offset;

            self.view.frame = frame;

        }];

    }
    return YES;
}

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField

{

    [UIView animateWithDuration:0.3 animations:^{

        CGRect frame = self.view.frame;

        frame.origin.y = 0.0;

        self.view.frame = frame;

    }];

    return YES;

}

  

2,点击收起

[_OtherTextField resignFirstResponder];

posted @ 2016-01-11 16:43  欢欢0919  阅读(122)  评论(0)    收藏  举报