Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Keyboard dragging fixes #220

Merged
merged 2 commits into from
Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Examples/Messenger-Shared/MessageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ - (void)editLastMessage:(id)sender

#pragma mark - Overriden Methods

- (BOOL)ignoreTextInputbarAdjustment
{
return NO;
}

- (void)didChangeKeyboardStatus:(SLKKeyboardStatus)status
{
// Notifies the view controller that the keyboard changed status.
Expand Down
9 changes: 4 additions & 5 deletions Source/Additions/SLKTextView+SLKAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ - (NSString *)slk_wordAtRange:(NSRange)range rangeInText:(NSRangePointer)rangePo
*rangePointer = [text rangeOfString:word];
word = [[word componentsSeparatedByString:@"\n"] lastObject];
}

return word;
}

Expand All @@ -161,10 +161,9 @@ - (void)slk_prepareForUndo:(NSString *)description
return;
}

SLKTextView *prepareInvocation = [self.undoManager prepareWithInvocationTarget:self];
[prepareInvocation setText:self.text];
[self.undoManager setActionName:description];

SLKTextView *prepareInvocation = [self.undoManager prepareWithInvocationTarget:self];
[prepareInvocation setText:self.text];
[self.undoManager setActionName:description];
}

@end
2 changes: 1 addition & 1 deletion Source/Additions/UIResponder+SLKAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
*/
+ (instancetype)slk_currentFirstResponder;

@end
@end
2 changes: 1 addition & 1 deletion Source/Additions/UIScrollView+SLKAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
*/
- (void)slk_stopScrolling;

@end
@end
2 changes: 1 addition & 1 deletion Source/Additions/UIView+SLKAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void)slk_animateLayoutIfNeededWithDuration:(NSTimeInterval)duration bounce:(B
options:options
animations:^{
[self layoutIfNeeded];

if (animations) {
animations();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/SLKInputAccessoryView.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
/* The system keyboard view used as reference. */
@property (nonatomic, weak, readonly) UIView *keyboardViewProxy;

@end
@end
2 changes: 1 addition & 1 deletion Source/Classes/SLKInputAccessoryView.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
}
}

@end
@end
2 changes: 1 addition & 1 deletion Source/Classes/SLKTextInputbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef NS_ENUM(NSUInteger, SLKCounterPosition) {
/** A Boolean value indicating whether the control is in edit mode. */
@property (nonatomic, getter = isEditing) BOOL editing;

/**
/**
Verifies if the text can be edited.

@param text The text to be edited.
Expand Down
14 changes: 7 additions & 7 deletions Source/Classes/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ - (void)slk_commonInit
self.autoHideRightButton = YES;
self.editorContentViewHeight = 38.0;
self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 5.0, 8.0);

[self addSubview:self.editorContentView];
[self addSubview:self.leftButton];
[self addSubview:self.rightButton];
[self addSubview:self.textView];
[self addSubview:self.charCountLabel];

[self slk_setupViewConstraints];
[self slk_updateConstraintConstants];

Expand Down Expand Up @@ -445,7 +445,7 @@ - (BOOL)canEditText:(NSString *)text
if (self.isEditing && [self.textView.text isEqualToString:text]) {
return NO;
}

return YES;
}

Expand Down Expand Up @@ -586,7 +586,7 @@ - (void)slk_setupViewConstraints

CGFloat leftVerMargin = (self.intrinsicContentSize.height - leftButtonImg.size.height) / 2.0;
CGFloat rightVerMargin = (self.intrinsicContentSize.height - CGRectGetHeight(self.rightButton.frame)) / 2.0;

NSDictionary *views = @{@"textView": self.textView,
@"leftButton": self.leftButton,
@"rightButton": self.rightButton,
Expand Down Expand Up @@ -618,15 +618,15 @@ - (void)slk_setupViewConstraints

self.leftMarginWC = [self slk_constraintsForAttribute:NSLayoutAttributeLeading][0];
self.bottomMarginWC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.leftButton];

self.rightButtonWC = [self slk_constraintForAttribute:NSLayoutAttributeWidth firstItem:self.rightButton secondItem:nil];
self.rightMarginWC = [self slk_constraintsForAttribute:NSLayoutAttributeTrailing][0];
}

- (void)slk_updateConstraintConstants
{
CGFloat zero = 0.0;

if (self.isEditing)
{
self.editorContentViewHC.constant = self.editorContentViewHeight;
Expand All @@ -639,7 +639,7 @@ - (void)slk_updateConstraintConstants
}
else {
self.editorContentViewHC.constant = zero;

CGSize leftButtonSize = [self.leftButton imageForState:self.leftButton.state].size;

if (leftButtonSize.width > 0) {
Expand Down
4 changes: 2 additions & 2 deletions Source/Classes/SLKTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ - (id)slk_pastedItem
{
NSString *contentType = [self slk_pasteboardContentType];
NSData *data = [[UIPasteboard generalPasteboard] dataForPasteboardType:contentType];

if (data && [data isKindOfClass:[NSData class]])
{
SLKPastableMediaType mediaType = SLKPastableMediaTypeFromNSString(contentType);
Expand Down Expand Up @@ -467,7 +467,7 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
&& self.selectedRange.length > 0) {
return YES;
}

if (action == @selector(paste:) && [self slk_isPasteboardItemSupported]) {
return YES;
}
Expand Down
18 changes: 9 additions & 9 deletions Source/Classes/SLKTextViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
/**
Initializes a collection view controller and configures the collection view with the provided layout.
If you use the standard -init method, a table view with plain style will be created.

@param layout The layout object to associate with the collection view. The layout controls how the collection view presents its cells and supplementary views.
@return An initialized SLKTextViewController object or nil if the object could not be created.
*/
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout SLK_DESIGNATED_INITIALIZER;

/**
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.

@param a UISCrollView to be used as the main content area.
@return An initialized SLKTextViewController object or nil if the object could not be created.
*/
Expand Down Expand Up @@ -196,7 +196,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
/**
Verifies if the text input bar should still move up/down even if it is not first responder. Default is NO.
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.

@param responder The current first responder object.
@return YES so the text input bar still move up/down.
*/
Expand Down Expand Up @@ -269,7 +269,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
*/
- (BOOL)canPressRightButton;

/**
/**
Notifies the view controller when the user has pasted a supported media content (images and/or videos).
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.
Only supported pastable medias configured in SLKTextView will be forwarded (take a look at SLKPastableMediaType).
Expand Down Expand Up @@ -323,7 +323,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
/**
Re-uses the text layout for edition, displaying an accessory view on top of the text input bar with options (cancel & save).
You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

@param text The string text to edit.
*/
- (void)editText:(NSString *)text NS_REQUIRES_SUPER;
Expand Down Expand Up @@ -387,15 +387,15 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
/**
Returns a custom height for the autocompletion view. Default is 0.0.
You can override this method to return a custom height.

@return The autocompletion view's height.
*/
- (CGFloat)heightForAutoCompletionView;

/**
Returns the maximum height for the autocompletion view. Default is 140 pts.
You can override this method to return a custom max height.

@return The autocompletion view's max height.
*/
- (CGFloat)maximumHeightForAutoCompletionView;
Expand All @@ -405,7 +405,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
*/
- (void)cancelAutoCompletion;

/**
/**
Accepts the autocompletion, replacing the detected word with a new string, keeping the prefix.
This method is an abstraction of -acceptAutoCompletionWithString:keepPrefix:

Expand Down Expand Up @@ -466,7 +466,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
Registers a class for customizing the behavior and appearance of the typing indicator view.
You need to call this method inside of any initialization method.
Make sure to conform to SLKTypingIndicatorProtocol and implement the required methods.

@param aClass A UIView subclass conforming to the SLKTypingIndicatorProtocol.
*/
- (void)registerClassForTypingIndicatorView:(Class)aClass;
Expand Down
Loading