I have a footer UIView at the bottom of my iOS Screen about 50 pixels high. During the loading phase of this view, I add a subview (lets say footer-subview), and programmatically add constraints to all edges with a constant of 0 (basically covering the entire footer view).
I register for the keyboardWillShow notification and within it I change the constraint to my footer view (not to be confused with the constraints mentioned in the previous paragraph), this is just one constraint that controls the outer-footer-views position) so that it shows right above the keyboard. Theoretically changing this constraint should change all related constraints along with it, specifically the outer edge constraints of my footer-subview.
When the keyboard shows, the footer view animates well with the animation of the showing keyboard, but there is a slight delay for the constraints of my footer-subview inside the footer view to update, which gives an unsightly visual effect where my footer is blank for a split second.
Here is the code for my keyboardWillShowNotifcation
- (void)keyboardWillShow:(NSNotification *)notification
{
_keyboardIsVisible = YES;
CGRect keyboardSize;
[[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardSize];
[UIView animateWithDuration:0.35f
delay:0
options:UIViewAnimationCurveLinear | UIViewAnimationOptionBeginFromCurrentState
animations:^{
[_footerTopSpaceConstraint setConstant:-1 * CGRectGetHeight(keyboardSize)];
[self.view layoutIfNeeded];
}
completion:nil];
}
Any tips on how to get the footer-subview constraints updated "quicker" so that they animate well with its parent, the footer view?