Bug report: Shrink the popup height in portrait for devices with screen bigger than iphone 5.

The Cancel and Send buttons will be thus displayed
This commit is contained in:
manuroe
2017-05-03 17:08:21 +02:00
parent 235e7959e9
commit d71e58b107
3 changed files with 59 additions and 26 deletions
+34 -1
View File
@@ -52,7 +52,8 @@
{
self.providesPresentationContextTransitionStyle = YES;
self.definesPresentationContext = YES;
self.modalPresentationStyle = UIModalPresentationOverCurrentContext;
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[viewController presentViewController:self animated:YES completion:nil];
}
@@ -111,6 +112,14 @@
[sendScreenshotTapGesture setNumberOfTouchesRequired:1];
[_sendScreenshotContainer addGestureRecognizer:sendScreenshotTapGesture];
_sendScreenshotContainer.userInteractionEnabled = YES;
// Add an accessory view in order to retrieve keyboard view
_bugReportDescriptionTextView.inputAccessoryView = [[UIView alloc] initWithFrame:CGRectZero];
}
- (void)dealloc
{
_bugReportDescriptionTextView.inputAccessoryView = nil;
}
- (void)setSendLogs:(BOOL)sendLogs
@@ -139,6 +148,30 @@
}
}
#pragma mark - MXKViewController
- (void)onKeyboardShowAnimationComplete
{
self.keyboardView = _bugReportDescriptionTextView.inputAccessoryView.superview;
}
-(void)setKeyboardHeight:(CGFloat)keyboardHeight
{
// In portrait in 6/7 and 6+/7+, make the height of the popup smaller to be able to
// display Cancel and Send buttons.
// Do nothing in landscape or in 5 in portrait and in landscape. There will be not enough
// room to display bugReportDescriptionTextView.
if (self.view.frame.size.height > 568)
{
self.scrollViewBottomConstraint.constant = keyboardHeight;
}
else
{
self.scrollViewBottomConstraint.constant = 0;
}
[self.view layoutIfNeeded];
}
#pragma mark - UITextViewDelegate
- (void)textViewDidChange:(UITextView *)textView