I have a button with a constraint that relates the button's bottom to the bottom layout guide. Upon tapping on a UITextField, thus bringing up the default software keyboard, the keyboard hides the button. The aforementioned constraint's constant is supposed to be set such that the button shifts far enough upward that the button is not hidden, but the latter is not happening. Instead, the button appears to be going offscreen.
Edit: The button in question also has a height constraint that keeps the height constant, but that constraint is orange. However, the width constraint is red.
Here is the code that causes the change:
Edit: The button in question also has a height constraint that keeps the height constant, but that constraint is orange. However, the width constraint is red.
Here is the code that causes the change:
Code:
-(void)keyboardDidShow:(NSNotification *)notification
{
CGRect keyboardFrameInWindow = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect keyboardFrame = [self.viewconvertRect:keyboardFrameInWindow fromView:self.view.window];
NSInteger constant = CGRectGetMaxY(self.view.bounds) - CGRectGetMinY(keyboardFrame);
buttonConstraint.constant = constant;
}
Last edited: