Bug Fix - New invite button should still be visible when the keyboard is shown

#961
This commit is contained in:
giomfo
2017-01-26 10:48:04 +01:00
parent 3e392e8c2a
commit 256105bde3
@@ -55,6 +55,7 @@
// Display a button to invite new member.
UIImageView* addParticipantButtonImageView;
NSLayoutConstraint *addParticipantButtonImageViewBottomConstraint;
MXKAlert *currentAlert;
}
@@ -258,12 +259,18 @@
CGRect currentBounds = tableViewMaskLayer.bounds;
CGRect newBounds = CGRectIntegral(self.view.frame);
newBounds.size.height -= self.keyboardHeight;
// check if there is an update
if (!CGSizeEqualToSize(currentBounds.size, newBounds.size))
{
newBounds.origin = CGPointZero;
tableViewMaskLayer.bounds = newBounds;
}
// Hide the addParticipants button on landscape when keyboard is visible
BOOL isLandscapeOriented = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
addParticipantButtonImageView.hidden = tableViewMaskLayer.hidden = (isLandscapeOriented && self.keyboardHeight);
}
}
@@ -456,6 +463,14 @@
}
}
- (void)setKeyboardHeight:(CGFloat)keyboardHeight
{
// Update addParticipants button position
addParticipantButtonImageViewBottomConstraint.constant = keyboardHeight + 9;
super.keyboardHeight = keyboardHeight;
}
#pragma mark - Internals
- (void)refreshTableView
@@ -529,16 +544,16 @@
multiplier:1
constant:0];
NSLayoutConstraint* bottomConstraint = [NSLayoutConstraint constraintWithItem:self.view
addParticipantButtonImageViewBottomConstraint = [NSLayoutConstraint constraintWithItem:self.view
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:addParticipantButtonImageView
attribute:NSLayoutAttributeBottom
multiplier:1
constant:9];
constant:self.keyboardHeight + 9];
// Available on iOS 8 and later
[NSLayoutConstraint activateConstraints:@[widthConstraint, heightConstraint, centerXConstraint, bottomConstraint]];
[NSLayoutConstraint activateConstraints:@[widthConstraint, heightConstraint, centerXConstraint, addParticipantButtonImageViewBottomConstraint]];
addParticipantButtonImageView.userInteractionEnabled = YES;