Skip to content

Commit 52d145e

Browse files
committed
Merge pull request slackhq#220 from slackhq/keyboard-dragging-fixes
Keyboard dragging fixes
2 parents 3aff7f7 + 5bf3af6 commit 52d145e

14 files changed

+86
-81
lines changed

Examples/Messenger-Shared/MessageViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ - (void)editLastMessage:(id)sender
216216

217217
#pragma mark - Overriden Methods
218218

219+
- (BOOL)ignoreTextInputbarAdjustment
220+
{
221+
return NO;
222+
}
223+
219224
- (void)didChangeKeyboardStatus:(SLKKeyboardStatus)status
220225
{
221226
// Notifies the view controller that the keyboard changed status.

Source/Additions/SLKTextView+SLKAdditions.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ - (NSString *)slk_wordAtRange:(NSRange)range rangeInText:(NSRangePointer)rangePo
151151
*rangePointer = [text rangeOfString:word];
152152
word = [[word componentsSeparatedByString:@"\n"] lastObject];
153153
}
154-
154+
155155
return word;
156156
}
157157

@@ -161,10 +161,9 @@ - (void)slk_prepareForUndo:(NSString *)description
161161
return;
162162
}
163163

164-
SLKTextView *prepareInvocation = [self.undoManager prepareWithInvocationTarget:self];
165-
[prepareInvocation setText:self.text];
166-
[self.undoManager setActionName:description];
167-
164+
SLKTextView *prepareInvocation = [self.undoManager prepareWithInvocationTarget:self];
165+
[prepareInvocation setText:self.text];
166+
[self.undoManager setActionName:description];
168167
}
169168

170169
@end

Source/Additions/UIResponder+SLKAdditions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
*/
2727
+ (instancetype)slk_currentFirstResponder;
2828

29-
@end
29+
@end

Source/Additions/UIScrollView+SLKAdditions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
*/
4646
- (void)slk_stopScrolling;
4747

48-
@end
48+
@end

Source/Additions/UIView+SLKAdditions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ - (void)slk_animateLayoutIfNeededWithDuration:(NSTimeInterval)duration bounce:(B
5454
options:options
5555
animations:^{
5656
[self layoutIfNeeded];
57-
57+
5858
if (animations) {
5959
animations();
6060
}

Source/Classes/SLKInputAccessoryView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
/* The system keyboard view used as reference. */
2222
@property (nonatomic, weak, readonly) UIView *keyboardViewProxy;
2323

24-
@end
24+
@end

Source/Classes/SLKInputAccessoryView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
2828
}
2929
}
3030

31-
@end
31+
@end

Source/Classes/SLKTextInputbar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ typedef NS_ENUM(NSUInteger, SLKCounterPosition) {
101101
/** A Boolean value indicating whether the control is in edit mode. */
102102
@property (nonatomic, getter = isEditing) BOOL editing;
103103

104-
/**
104+
/**
105105
Verifies if the text can be edited.
106106
107107
@param text The text to be edited.

Source/Classes/SLKTextInputbar.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ - (void)slk_commonInit
7575
self.autoHideRightButton = YES;
7676
self.editorContentViewHeight = 38.0;
7777
self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 5.0, 8.0);
78-
78+
7979
[self addSubview:self.editorContentView];
8080
[self addSubview:self.leftButton];
8181
[self addSubview:self.rightButton];
8282
[self addSubview:self.textView];
8383
[self addSubview:self.charCountLabel];
84-
84+
8585
[self slk_setupViewConstraints];
8686
[self slk_updateConstraintConstants];
8787

@@ -445,7 +445,7 @@ - (BOOL)canEditText:(NSString *)text
445445
if (self.isEditing && [self.textView.text isEqualToString:text]) {
446446
return NO;
447447
}
448-
448+
449449
return YES;
450450
}
451451

@@ -586,7 +586,7 @@ - (void)slk_setupViewConstraints
586586

587587
CGFloat leftVerMargin = (self.intrinsicContentSize.height - leftButtonImg.size.height) / 2.0;
588588
CGFloat rightVerMargin = (self.intrinsicContentSize.height - CGRectGetHeight(self.rightButton.frame)) / 2.0;
589-
589+
590590
NSDictionary *views = @{@"textView": self.textView,
591591
@"leftButton": self.leftButton,
592592
@"rightButton": self.rightButton,
@@ -618,15 +618,15 @@ - (void)slk_setupViewConstraints
618618

619619
self.leftMarginWC = [self slk_constraintsForAttribute:NSLayoutAttributeLeading][0];
620620
self.bottomMarginWC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.leftButton];
621-
621+
622622
self.rightButtonWC = [self slk_constraintForAttribute:NSLayoutAttributeWidth firstItem:self.rightButton secondItem:nil];
623623
self.rightMarginWC = [self slk_constraintsForAttribute:NSLayoutAttributeTrailing][0];
624624
}
625625

626626
- (void)slk_updateConstraintConstants
627627
{
628628
CGFloat zero = 0.0;
629-
629+
630630
if (self.isEditing)
631631
{
632632
self.editorContentViewHC.constant = self.editorContentViewHeight;
@@ -639,7 +639,7 @@ - (void)slk_updateConstraintConstants
639639
}
640640
else {
641641
self.editorContentViewHC.constant = zero;
642-
642+
643643
CGSize leftButtonSize = [self.leftButton imageForState:self.leftButton.state].size;
644644

645645
if (leftButtonSize.width > 0) {

Source/Classes/SLKTextView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ - (id)slk_pastedItem
175175
{
176176
NSString *contentType = [self slk_pasteboardContentType];
177177
NSData *data = [[UIPasteboard generalPasteboard] dataForPasteboardType:contentType];
178-
178+
179179
if (data && [data isKindOfClass:[NSData class]])
180180
{
181181
SLKPastableMediaType mediaType = SLKPastableMediaTypeFromNSString(contentType);
@@ -467,7 +467,7 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
467467
&& self.selectedRange.length > 0) {
468468
return YES;
469469
}
470-
470+
471471
if (action == @selector(paste:) && [self slk_isPasteboardItemSupported]) {
472472
return YES;
473473
}

Source/Classes/SLKTextViewController.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
132132
/**
133133
Initializes a collection view controller and configures the collection view with the provided layout.
134134
If you use the standard -init method, a table view with plain style will be created.
135-
135+
136136
@param layout The layout object to associate with the collection view. The layout controls how the collection view presents its cells and supplementary views.
137137
@return An initialized SLKTextViewController object or nil if the object could not be created.
138138
*/
139139
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout SLK_DESIGNATED_INITIALIZER;
140140

141141
/**
142142
Initializes a text view controller to manage an arbitraty scroll view. The caller is responsible for configuration of the scroll view, including wiring the delegate.
143-
143+
144144
@param a UISCrollView to be used as the main content area.
145145
@return An initialized SLKTextViewController object or nil if the object could not be created.
146146
*/
@@ -196,7 +196,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
196196
/**
197197
Verifies if the text input bar should still move up/down even if it is not first responder. Default is NO.
198198
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.
199-
199+
200200
@param responder The current first responder object.
201201
@return YES so the text input bar still move up/down.
202202
*/
@@ -269,7 +269,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
269269
*/
270270
- (BOOL)canPressRightButton;
271271

272-
/**
272+
/**
273273
Notifies the view controller when the user has pasted a supported media content (images and/or videos).
274274
You can override this method to perform additional tasks associated with image/video pasting. You don't need to call super since this method doesn't do anything.
275275
Only supported pastable medias configured in SLKTextView will be forwarded (take a look at SLKPastableMediaType).
@@ -323,7 +323,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
323323
/**
324324
Re-uses the text layout for edition, displaying an accessory view on top of the text input bar with options (cancel & save).
325325
You can override this method to perform additional tasks. You MUST call super at some point in your implementation.
326-
326+
327327
@param text The string text to edit.
328328
*/
329329
- (void)editText:(NSString *)text NS_REQUIRES_SUPER;
@@ -387,15 +387,15 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
387387
/**
388388
Returns a custom height for the autocompletion view. Default is 0.0.
389389
You can override this method to return a custom height.
390-
390+
391391
@return The autocompletion view's height.
392392
*/
393393
- (CGFloat)heightForAutoCompletionView;
394394

395395
/**
396396
Returns the maximum height for the autocompletion view. Default is 140 pts.
397397
You can override this method to return a custom max height.
398-
398+
399399
@return The autocompletion view's max height.
400400
*/
401401
- (CGFloat)maximumHeightForAutoCompletionView;
@@ -405,7 +405,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
405405
*/
406406
- (void)cancelAutoCompletion;
407407

408-
/**
408+
/**
409409
Accepts the autocompletion, replacing the detected word with a new string, keeping the prefix.
410410
This method is an abstraction of -acceptAutoCompletionWithString:keepPrefix:
411411
@@ -466,7 +466,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
466466
Registers a class for customizing the behavior and appearance of the typing indicator view.
467467
You need to call this method inside of any initialization method.
468468
Make sure to conform to SLKTypingIndicatorProtocol and implement the required methods.
469-
469+
470470
@param aClass A UIView subclass conforming to the SLKTypingIndicatorProtocol.
471471
*/
472472
- (void)registerClassForTypingIndicatorView:(Class)aClass;

0 commit comments

Comments
 (0)