收起键盘

UITextField编辑时视图调整

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

转载于:https://www.cnblogs.com/conan0919/p/5121729.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值