diff --git a/Riot/ViewController/BugReportViewController.h b/Riot/ViewController/BugReportViewController.h index 34cea1291..1182622bc 100644 --- a/Riot/ViewController/BugReportViewController.h +++ b/Riot/ViewController/BugReportViewController.h @@ -16,9 +16,12 @@ #import -@interface BugReportViewController : UIViewController +#import + +@interface BugReportViewController : MXKViewController @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollViewBottomConstraint; @property (weak, nonatomic) IBOutlet UIView *containerView; @property (weak, nonatomic) IBOutlet UILabel *titleLabel; diff --git a/Riot/ViewController/BugReportViewController.m b/Riot/ViewController/BugReportViewController.m index 2c33bd8b8..bcb4e84d3 100644 --- a/Riot/ViewController/BugReportViewController.m +++ b/Riot/ViewController/BugReportViewController.m @@ -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 diff --git a/Riot/ViewController/BugReportViewController.xib b/Riot/ViewController/BugReportViewController.xib index 97de0a477..d4ed64587 100644 --- a/Riot/ViewController/BugReportViewController.xib +++ b/Riot/ViewController/BugReportViewController.xib @@ -1,6 +1,6 @@ - + @@ -18,6 +18,7 @@ + @@ -35,24 +36,24 @@ - + - + - + - + - + - + - + - + - + - + @@ -160,16 +161,16 @@