First Responder Resigns When Editing a Constraint

I'm trying to resize a height constraint when a user taps a UITextField. The idea is basically to expand a sub-view which contains two UITextFields when the user taps one of the fields (my intention is to display a table in the expanded area). The subview properly expands but the problem I'm having is that either text field immediately resigns as first responder when I change the constraint value and textFieldDidEndEditing executes right away. Is there some way I can edit a constraint without resigning responder status?

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    if (self.routeSelectionVC && (textField == self.routeSelectionVC.fromTextField || textField == self.routeSelectionVC.toTextField)) {
        self.headerBarViewHeightConstraint.constant = 288;
    }
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (self.routeSelectionVC && (textField == self.routeSelectionVC.fromTextField || textField == self.routeSelectionVC.toTextField)) {
        self.headerBarViewHeightConstraint.constant = 88;
    }
}

Thanks in advance!

链接地址: http://www.djcxy.com/p/44308.html

上一篇: UITextView恢复动画setFrame:在退出第一个响应者之后

下一篇: 第一个响应者在编辑约束时辞职