Skip to content

Commit 93c0df9

Browse files
committed
Merge pull request slackhq#216 from slackhq/textinput-adjustment-ignore
Adds the ability to ignore the textInputbar adjustment.
2 parents 9fc4b33 + f1fb9bd commit 93c0df9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Source/Classes/SLKTextViewController.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
202202
*/
203203
- (BOOL)forceTextInputbarAdjustmentForResponder:(UIResponder *)responder;
204204

205+
/**
206+
Verifies if the text input bar should still move up/down when it is first responder. Default is NO.
207+
This is very useful when presenting the view controller in a custom modal presentation, when there keyboard events are being handled externally to reframe the presented view.
208+
You don't need call super since this method doesn't do anything.
209+
*/
210+
- (BOOL)ignoreTextInputbarAdjustment;
211+
205212
/**
206213
Notifies the view controller that the keyboard changed status.
207214
You can override this method to perform additional tasks associated with presenting the view. You don't need call super since this method doesn't do anything.

Source/Classes/SLKTextViewController.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ - (CGFloat)slk_appropriateKeyboardHeight:(NSNotification *)notification
404404
return 0.0;
405405
}
406406

407+
if ([self ignoreTextInputbarAdjustment]) {
408+
return 0.0;
409+
}
410+
407411
CGRect endFrame = [self.view convertRect:[notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue] fromView:nil];
408412
return MAX(0.0, CGRectGetHeight(self.view.bounds) - CGRectGetMinY(endFrame) - CGRectGetHeight(self.inputAccessoryView.bounds));
409413
}
@@ -605,6 +609,11 @@ - (BOOL)forceTextInputbarAdjustmentForResponder:(UIResponder *)responder
605609
#pragma GCC diagnostic pop
606610
}
607611

612+
- (BOOL)ignoreTextInputbarAdjustment
613+
{
614+
return NO;
615+
}
616+
608617
- (void)didChangeKeyboardStatus:(SLKKeyboardStatus)status
609618
{
610619
// No implementation here. Meant to be overriden in subclass.

0 commit comments

Comments
 (0)