首页 > 其他 > 详细

收起键盘

时间:2016-01-11 18:01:57      阅读:258      评论:0      收藏:0      [点我收藏+]

#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];

收起键盘

原文:http://www.cnblogs.com/conan0919/p/5121729.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!