Inherits from UIViewController
Conforms to SLKTextViewDelegate
UIAlertViewDelegate
UICollectionViewDataSource
UICollectionViewDelegate
UIGestureRecognizerDelegate
UITableViewDataSource
UITableViewDelegate
Declared in SLKTextViewController.h

Tasks

Other Methods

  •   tableView

    The main table view managed by the controller object. Created by default initializing with -init or initWithNibName:bundle:

    property
  •   collectionView

    The main collection view managed by the controller object. Not nil if the controller is initialised with initWithCollectionViewLayout:

    property
  •   scrollView

    The main scroll view managed by the controller object. Not nil if the controller is initialised with initWithScrollView:

    property
  •   textInputbar

    The bottom toolbar containing a text view and buttons.

    property
  •   typingIndicatorView

    The default typing indicator used to display user names horizontally.

    property
  •   typingIndicatorProxyView

    The custom typing indicator view. Default is kind of SLKTypingIndicatorView. To customize the typing indicator view, you will need to call registerClassForTypingIndicatorView: nside of any initialization method. To interact with it directly, you will need to cast the return value of -typingIndicatorProxyView to the appropriate type.

    property
  •   singleTapGesture

    A single tap gesture used to dismiss the keyboard. SLKTextViewController is its delegate.

    property
  •   verticalPanGesture

    A vertical pan gesture used for bringing the keyboard from the bottom. SLKTextViewController is its delegate.

    property
  •   bounces

    YES if control’s animation should have bouncy effects. Default is YES.

    property
  •   shakeToClearEnabled

    YES if text view’s content can be cleaned with a shake gesture. Default is NO.

    property
  •   keyboardPanningEnabled

    YES if keyboard can be dismissed gradually with a vertical panning gesture. Default is YES.

    property
  •   externalKeyboardDetected

    YES if an external keyboard has been detected (this value updates only when the text view becomes first responder).

    property
  •   keyboardUndocked

    YES if the keyboard has been detected as undocked or split (iPad Only).

    property
  •   shouldClearTextAtRightButtonPress

    YES if after right button press, the text view is cleared out. Default is YES.

    property
  •   shouldScrollToBottomAfterKeyboardShows

    YES if the scrollView should scroll to bottom when the keyboard is shown. Default is NO.

    property
  •   inverted

    YES if the main table view is inverted. Default is YES. This allows the table view to start from the bottom like any typical messaging interface. If inverted, you must assign the same transform property to your cells to match the orientation (ie: cell.transform = tableView.transform;) Inverting the table view will enable some great features such as content offset corrections automatically when resizing the text input and/or showing autocompletion.

    property
  •   presentedInPopover

    YES if the view controller is presented inside of a popover controller. If YES, the keyboard won’t move the text input bar and tapping on the tableView/collectionView will not cause the keyboard to be dismissed. This property is compatible only with iPad.

    property
  •   textView

    Convenience accessors (accessed through the text input bar)

    property
  •   leftButton property
  •   rightButton property

Initialization

Keyboard Handling

  • – presentKeyboard:

    Presents the keyboard, if not already, animated. You can override this method to perform additional tasks associated with presenting the keyboard. You SHOULD call super to inherit some conditionals.

  • – dismissKeyboard:

    Dimisses the keyboard, if not already, animated. You can override this method to perform additional tasks associated with dismissing the keyboard. You SHOULD call super to inherit some conditionals.

  • – forceTextInputbarAdjustmentForResponder:

    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.

  • – ignoreTextInputbarAdjustment

    Verifies if the text input bar should still move up/down when it is first responder. Default is NO. 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. You SHOULD call super to inherit some conditionals.

  • – didChangeKeyboardStatus:

    Notifies the view controller that the keyboard changed status. 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.

Interaction Notifications

  • – textWillUpdate

    Notifies the view controller that the text will update. You can override this method to perform additional tasks associated with text changes. You MUST call super at some point in your implementation.

  • – textDidUpdate:

    Notifies the view controller that the text did update. You can override this method to perform additional tasks associated with text changes. You MUST call super at some point in your implementation.

  • – textSelectionDidChange

    Notifies the view controller that the text selection did change. Use this method a replacement of UITextViewDelegate’s -textViewDidChangeSelection: which is not reliable enough when using third-party keyboards (they don’t forward events properly sometimes).

  • – didPressLeftButton:

    Notifies the view controller when the left button’s action has been triggered, manually. You can override this method to perform additional tasks associated with the left button. You don’t need call super since this method doesn’t do anything.

  • – didPressRightButton:

    Notifies the view controller when the right button’s action has been triggered, manually or by using the keyboard return key. You can override this method to perform additional tasks associated with the right button. You MUST call super at some point in your implementation.

  • – canPressRightButton

    Verifies if the right button can be pressed. If NO, the button is disabled. You can override this method to perform additional tasks. You SHOULD call super to inherit some conditionals.

  • – didPasteMediaContent:

    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).

  • – canShowTypingIndicator

    Verifies that the typing indicator view should be shown. Default is YES, if meeting some requierements. You can override this method to perform additional tasks. You SHOULD call super to inherit some conditionals.

  • – willRequestUndo

    Notifies the view controller when the user has shaked the device for undoing text typing. You can override this method to perform additional tasks associated with the shake gesture. Calling super will prompt a system alert view with undo option. This will not be called if ‘undoShakingEnabled’ is set to NO and/or if the text view’s content is empty.

  • – didPressReturnKey:

    Notifies the view controller when the user has pressed the Return key (↵) with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

  • – didPressEscapeKey:

    Notifies the view controller when the user has pressed the Escape key (Esc) with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

  • – didPressArrowKey:

    Notifies the view controller when the user has pressed the arrow key with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

Text Input Bar Adjustment

  •   textInputbarHidden

    YES if the text inputbar is hidden. Default is NO.

    property
  • – setTextInputbarHidden:animated:

    Changes the visibility of the text input bar. Calling this method with the animated parameter set to NO is equivalent to setting the value of the toolbarHidden property directly.

Text Edition

  •   editing

    YES if the text editing mode is active.

    property
  • – editText:

    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.

  • – didCommitTextEditing:

    Notifies the view controller when the editing bar’s right button’s action has been triggered, manually or by using the external keyboard’s Return key. You can override this method to perform additional tasks associated with accepting changes. You MUST call super at some point in your implementation.

  • – didCancelTextEditing:

    Notifies the view controller when the editing bar’s right button’s action has been triggered, manually or by using the external keyboard’s Esc key. You can override this method to perform additional tasks associated with accepting changes. You MUST call super at some point in your implementation.

Text Auto-Completion

  •   autoCompletionView

    The table view used to display autocompletion results.

    property
  •   autoCompleting

    YES if the autocompletion mode is active.

    property
  •   foundPrefix

    The recently found prefix symbol used as prefix for autocompletion mode.

    property
  •   foundPrefixRange

    The range of the found prefix in the text view content.

    property
  •   foundWord

    The recently found word at the text view’s caret position.

    property
  •   registeredPrefixes

    An array containing all the registered prefix strings for autocompletion.

    property
  • – registerPrefixesForAutoCompletion:

    Registers any string prefix for autocompletion detection, useful for user mentions and/or hashtags autocompletion. The prefix must be valid string (i.e: ‘@’, ‘#’, ‘\’, and so on). This also checks if no repeated prefix are inserted. Prefixes can be of any length.

  • – didChangeAutoCompletionPrefix:andWord:

    Notifies the view controller either the autocompletion prefix or word have changed. Use this method to modify your data source or fetch data asynchronously from an HTTP resource. Once your data source is ready, make sure to call showAutoCompletionView: to display the view accordingly. You don’t need call super since this method doesn’t do anything.

  • – showAutoCompletionView:

    Use this method to programatically show/hide the autocompletion view. Right before the view is shown, -reloadData is called. So avoid calling it manually.

  • – canShowAutoCompletion

    Verifies that the autocompletion view should be shown. Default is NO. To enabled autocompletion, you MUST override this method to perform additional tasks, before the autocompletion view is shown (i.e. populating the data source).

  • – heightForAutoCompletionView

    Returns a custom height for the autocompletion view. Default is 0.0. You can override this method to return a custom height.

  • – maximumHeightForAutoCompletionView

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

  • – cancelAutoCompletion

    Cancels and hides the autocompletion view, animated.

  • – acceptAutoCompletionWithString:

    Accepts the autocompletion, replacing the detected word with a new string, keeping the prefix. This method is a convinience of acceptAutoCompletionWithString:keepPrefix:

  • – acceptAutoCompletionWithString:keepPrefix:

    Accepts the autocompletion, replacing the detected word with a new string, and optionally replacing the prefix too.

Text Caching

  • – keyForTextCaching

    Returns the key to be associated with a given text to be cached. Default is nil. To enable text caching, you must override this method to return valid key. The text view will be populated automatically when the view controller is configured. You don’t need to call super since this method doesn’t do anything.

  • – clearCachedText

    Removes the current’s vien controller cached text. To enable this, you must return a valid key string in keyForTextCaching.

  • + clearAllCachedText

    Removes all the cached text from disk.

Customization

Delegate Methods Requiring Super

Life Cycle Methods Requiring Super

Properties

autoCompleting

@property (nonatomic, readonly, getter=isAutoCompleting) BOOL autoCompleting
Discussion

YES if the autocompletion mode is active.

Declared In

SLKTextViewController.h

autoCompletionView

@property (nonatomic, readonly) UITableView *autoCompletionView
Discussion

The table view used to display autocompletion results.

Declared In

SLKTextViewController.h

bounces

@property (nonatomic, assign) BOOL bounces
Discussion

YES if control’s animation should have bouncy effects. Default is YES.

Declared In

SLKTextViewController.h

collectionView

@property (nonatomic, readonly) UICollectionView *collectionView
Discussion

The main collection view managed by the controller object. Not nil if the controller is initialised with initWithCollectionViewLayout:

Declared In

SLKTextViewController.h

editing

@property (nonatomic, readonly, getter=isEditing) BOOL editing
Discussion

YES if the text editing mode is active.

Declared In

SLKTextViewController.h

externalKeyboardDetected

@property (nonatomic, readonly, getter=isExternalKeyboardDetected) BOOL externalKeyboardDetected
Discussion

YES if an external keyboard has been detected (this value updates only when the text view becomes first responder).

Declared In

SLKTextViewController.h

foundPrefix

@property (nonatomic, readonly, copy) NSString *foundPrefix
Discussion

The recently found prefix symbol used as prefix for autocompletion mode.

Declared In

SLKTextViewController.h

foundPrefixRange

@property (nonatomic, readonly) NSRange foundPrefixRange
Discussion

The range of the found prefix in the text view content.

Declared In

SLKTextViewController.h

foundWord

@property (nonatomic, readonly, copy) NSString *foundWord
Discussion

The recently found word at the text view’s caret position.

Declared In

SLKTextViewController.h

inverted

@property (nonatomic, assign, getter=isInverted) BOOL inverted
Discussion

YES if the main table view is inverted. Default is YES. This allows the table view to start from the bottom like any typical messaging interface. If inverted, you must assign the same transform property to your cells to match the orientation (ie: cell.transform = tableView.transform;) Inverting the table view will enable some great features such as content offset corrections automatically when resizing the text input and/or showing autocompletion.

Declared In

SLKTextViewController.h

keyboardPanningEnabled

@property (nonatomic, assign, getter=isKeyboardPanningEnabled) BOOL keyboardPanningEnabled
Discussion

YES if keyboard can be dismissed gradually with a vertical panning gesture. Default is YES.

Declared In

SLKTextViewController.h

keyboardUndocked

@property (nonatomic, readonly, getter=isKeyboardUndocked) BOOL keyboardUndocked
Discussion

YES if the keyboard has been detected as undocked or split (iPad Only).

Declared In

SLKTextViewController.h

leftButton

@property (nonatomic, readonly) UIButton *leftButton

presentedInPopover

@property (nonatomic, assign, getter=isPresentedInPopover) BOOL presentedInPopover
Discussion

YES if the view controller is presented inside of a popover controller. If YES, the keyboard won’t move the text input bar and tapping on the tableView/collectionView will not cause the keyboard to be dismissed. This property is compatible only with iPad.

Declared In

SLKTextViewController.h

registeredPrefixes

@property (nonatomic, readonly, copy) NSArray *registeredPrefixes
Discussion

An array containing all the registered prefix strings for autocompletion.

Declared In

SLKTextViewController.h

rightButton

@property (nonatomic, readonly) UIButton *rightButton

scrollView

@property (nonatomic, readonly) UIScrollView *scrollView
Discussion

The main scroll view managed by the controller object. Not nil if the controller is initialised with initWithScrollView:

Declared In

SLKTextViewController.h

shakeToClearEnabled

@property (nonatomic, assign) BOOL shakeToClearEnabled
Discussion

YES if text view’s content can be cleaned with a shake gesture. Default is NO.

Declared In

SLKTextViewController.h

shouldClearTextAtRightButtonPress

@property (nonatomic, assign) BOOL shouldClearTextAtRightButtonPress
Discussion

YES if after right button press, the text view is cleared out. Default is YES.

Declared In

SLKTextViewController.h

shouldScrollToBottomAfterKeyboardShows

@property (nonatomic, assign) BOOL shouldScrollToBottomAfterKeyboardShows
Discussion

YES if the scrollView should scroll to bottom when the keyboard is shown. Default is NO.

Declared In

SLKTextViewController.h

singleTapGesture

@property (nonatomic, readonly) UIGestureRecognizer *singleTapGesture
Discussion

A single tap gesture used to dismiss the keyboard. SLKTextViewController is its delegate.

Declared In

SLKTextViewController.h

tableView

@property (nonatomic, readonly) UITableView *tableView
Discussion

The main table view managed by the controller object. Created by default initializing with -init or initWithNibName:bundle:

Declared In

SLKTextViewController.h

textInputbar

@property (nonatomic, readonly) SLKTextInputbar *textInputbar
Discussion

The bottom toolbar containing a text view and buttons.

Declared In

SLKTextViewController.h

textInputbarHidden

@property (nonatomic, getter=isTextInputbarHidden) BOOL textInputbarHidden
Discussion

YES if the text inputbar is hidden. Default is NO.

Declared In

SLKTextViewController.h

textView

@property (nonatomic, readonly) SLKTextView *textView
Discussion

Convenience accessors (accessed through the text input bar)

Declared In

SLKTextViewController.h

typingIndicatorProxyView

@property (nonatomic, readonly) UIView<SLKTypingIndicatorProtocol> *typingIndicatorProxyView
Discussion

The custom typing indicator view. Default is kind of SLKTypingIndicatorView. To customize the typing indicator view, you will need to call registerClassForTypingIndicatorView: nside of any initialization method. To interact with it directly, you will need to cast the return value of -typingIndicatorProxyView to the appropriate type.

Declared In

SLKTextViewController.h

typingIndicatorView

@property (nonatomic, readonly) SLKTypingIndicatorView *typingIndicatorView
Discussion

The default typing indicator used to display user names horizontally.

Declared In

SLKTextViewController.h

verticalPanGesture

@property (nonatomic, readonly) UIPanGestureRecognizer *verticalPanGesture
Discussion

A vertical pan gesture used for bringing the keyboard from the bottom. SLKTextViewController is its delegate.

Declared In

SLKTextViewController.h

Class Methods

clearAllCachedText

+ (void)clearAllCachedText
Discussion

Removes all the cached text from disk.

Declared In

SLKTextViewController.h

collectionViewLayoutForCoder:

+ (UICollectionViewLayout *)collectionViewLayoutForCoder:(NSCoder *)decoder
Discussion

Returns the tableView style to be configured when using Interface Builder. Default is nil. You must override this method if you want to configure a collectionView.

Parameters

decoder

An unarchiver object.

Return Value

The collectionView style to be used in the new instantiated collectionView.

Declared In

SLKTextViewController.h

tableViewStyleForCoder:

+ (UITableViewStyle)tableViewStyleForCoder:(NSCoder *)decoder
Discussion

Returns the tableView style to be configured when using Interface Builder. Default is UITableViewStylePlain. You must override this method if you want to configure a tableView.

Parameters

decoder

An unarchiver object.

Return Value

The tableView style to be used in the new instantiated tableView.

Declared In

SLKTextViewController.h

Instance Methods

acceptAutoCompletionWithString:

- (void)acceptAutoCompletionWithString:(NSString *)string
Discussion

Accepts the autocompletion, replacing the detected word with a new string, keeping the prefix. This method is a convinience of acceptAutoCompletionWithString:keepPrefix:

Parameters

string

The string to be used for replacing autocompletion placeholders.

Declared In

SLKTextViewController.h

acceptAutoCompletionWithString:keepPrefix:

- (void)acceptAutoCompletionWithString:(NSString *)string keepPrefix:(BOOL)keepPrefix
Discussion

Accepts the autocompletion, replacing the detected word with a new string, and optionally replacing the prefix too.

Parameters

string

The string to be used for replacing autocompletion placeholders.

keepPrefix

YES if the prefix shouldn’t be overidden.

Declared In

SLKTextViewController.h

alertView:clickedButtonAtIndex:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
Discussion

UIAlertViewDelegate

Declared In

SLKTextViewController.h

canPressRightButton

- (BOOL)canPressRightButton
Discussion

Verifies if the right button can be pressed. If NO, the button is disabled. You can override this method to perform additional tasks. You SHOULD call super to inherit some conditionals.

Return Value

YES if the right button can be pressed.

Declared In

SLKTextViewController.h

canShowAutoCompletion

- (BOOL)canShowAutoCompletion
Discussion

Verifies that the autocompletion view should be shown. Default is NO. To enabled autocompletion, you MUST override this method to perform additional tasks, before the autocompletion view is shown (i.e. populating the data source).

Return Value

YES if the autocompletion view should be shown.

Declared In

SLKTextViewController.h

canShowTypingIndicator

- (BOOL)canShowTypingIndicator
Discussion

Verifies that the typing indicator view should be shown. Default is YES, if meeting some requierements. You can override this method to perform additional tasks. You SHOULD call super to inherit some conditionals.

Return Value

YES if the typing indicator view should be presented.

Declared In

SLKTextViewController.h

cancelAutoCompletion

- (void)cancelAutoCompletion
Discussion

Cancels and hides the autocompletion view, animated.

Declared In

SLKTextViewController.h

clearCachedText

- (void)clearCachedText
Discussion

Removes the current’s vien controller cached text. To enable this, you must return a valid key string in keyForTextCaching.

Declared In

SLKTextViewController.h

didCancelTextEditing:

- (void)didCancelTextEditing:(id)sender
Discussion

Notifies the view controller when the editing bar’s right button’s action has been triggered, manually or by using the external keyboard’s Esc key. You can override this method to perform additional tasks associated with accepting changes. You MUST call super at some point in your implementation.

Parameters

sender

The object calling this method.

Declared In

SLKTextViewController.h

didChangeAutoCompletionPrefix:andWord:

- (void)didChangeAutoCompletionPrefix:(NSString *)prefix andWord:(NSString *)word
Discussion

Notifies the view controller either the autocompletion prefix or word have changed. Use this method to modify your data source or fetch data asynchronously from an HTTP resource. Once your data source is ready, make sure to call showAutoCompletionView: to display the view accordingly. You don’t need call super since this method doesn’t do anything.

Parameters

prefix

The detected prefix.

word

The derected word.

Declared In

SLKTextViewController.h

didChangeKeyboardStatus:

- (void)didChangeKeyboardStatus:(SLKKeyboardStatus)status
Discussion

Notifies the view controller that the keyboard changed status. 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.

Parameters

status

The new keyboard status.

Declared In

SLKTextViewController.h

didCommitTextEditing:

- (void)didCommitTextEditing:(id)sender
Discussion

Notifies the view controller when the editing bar’s right button’s action has been triggered, manually or by using the external keyboard’s Return key. You can override this method to perform additional tasks associated with accepting changes. You MUST call super at some point in your implementation.

Parameters

sender

The object calling this method.

Declared In

SLKTextViewController.h

didPasteMediaContent:

- (void)didPasteMediaContent:(NSDictionary *)userInfo
Discussion

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).

@para userInfo The payload containing the media data, content and media types.

Declared In

SLKTextViewController.h

didPressArrowKey:

- (void)didPressArrowKey:(id)sender
Discussion

Notifies the view controller when the user has pressed the arrow key with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

Declared In

SLKTextViewController.h

didPressEscapeKey:

- (void)didPressEscapeKey:(id)sender
Discussion

Notifies the view controller when the user has pressed the Escape key (Esc) with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

Declared In

SLKTextViewController.h

didPressLeftButton:

- (void)didPressLeftButton:(id)sender
Discussion

Notifies the view controller when the left button’s action has been triggered, manually. You can override this method to perform additional tasks associated with the left button. You don’t need call super since this method doesn’t do anything.

Parameters

sender

The object calling this method.

Declared In

SLKTextViewController.h

didPressReturnKey:

- (void)didPressReturnKey:(id)sender
Discussion

Notifies the view controller when the user has pressed the Return key (↵) with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation.

Declared In

SLKTextViewController.h

didPressRightButton:

- (void)didPressRightButton:(id)sender
Discussion

Notifies the view controller when the right button’s action has been triggered, manually or by using the keyboard return key. You can override this method to perform additional tasks associated with the right button. You MUST call super at some point in your implementation.

Parameters

sender

The object calling this method.

Declared In

SLKTextViewController.h

dismissKeyboard:

- (void)dismissKeyboard:(BOOL)animated
Discussion

Dimisses the keyboard, if not already, animated. You can override this method to perform additional tasks associated with dismissing the keyboard. You SHOULD call super to inherit some conditionals.

Parameters

animated

YES if the keyboard should be dismissed using an animation.

Declared In

SLKTextViewController.h

editText:

- (void)editText:(NSString *)text
Discussion

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.

Parameters

text

The string text to edit.

Declared In

SLKTextViewController.h

forceTextInputbarAdjustmentForResponder:

- (BOOL)forceTextInputbarAdjustmentForResponder:(UIResponder *)responder
Discussion

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.

Parameters

responder

The current first responder object.

Return Value

YES so the text input bar still move up/down.

Declared In

SLKTextViewController.h

gestureRecognizerShouldBegin:

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
Discussion

UIGestureRecognizerDelegate

Declared In

SLKTextViewController.h

heightForAutoCompletionView

- (CGFloat)heightForAutoCompletionView
Discussion

Returns a custom height for the autocompletion view. Default is 0.0. You can override this method to return a custom height.

Return Value

The autocompletion view’s height.

Declared In

SLKTextViewController.h

ignoreTextInputbarAdjustment

- (BOOL)ignoreTextInputbarAdjustment
Discussion

Verifies if the text input bar should still move up/down when it is first responder. Default is NO. 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. You SHOULD call super to inherit some conditionals.

Declared In

SLKTextViewController.h

initWithCoder:

- (instancetype)initWithCoder:(NSCoder *)decoder
Discussion

Initializes either a table or collection view controller. You must override either tableViewStyleForCoder: or collectionViewLayoutForCoder: to define witch view to be layed out.

Parameters

decoder

An unarchiver object.

Return Value

An initialized SLKTextViewController object or nil if the object could not be created.

Declared In

SLKTextViewController.h

initWithCollectionViewLayout:

- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
Discussion

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.

Parameters

layout

The layout object to associate with the collection view. The layout controls how the collection view presents its cells and supplementary views.

Return Value

An initialized SLKTextViewController object or nil if the object could not be created.

Declared In

SLKTextViewController.h

initWithScrollView:

- (instancetype)initWithScrollView:(UIScrollView *)scrollView
Discussion

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.

Parameters

a

UISCrollView to be used as the main content area.

Return Value

An initialized SLKTextViewController object or nil if the object could not be created.

Declared In

SLKTextViewController.h

initWithTableViewStyle:

- (instancetype)initWithTableViewStyle:(UITableViewStyle)style
Discussion

Initializes a text view controller to manage a table view of a given style. If you use the standard -init method, a table view with plain style will be created.

Parameters

style

A constant that specifies the style of main table view that the controller object is to manage (UITableViewStylePlain or UITableViewStyleGrouped).

Return Value

An initialized SLKTextViewController object or nil if the object could not be created.

Declared In

SLKTextViewController.h

keyForTextCaching

- (NSString *)keyForTextCaching
Discussion

Returns the key to be associated with a given text to be cached. Default is nil. To enable text caching, you must override this method to return valid key. The text view will be populated automatically when the view controller is configured. You don’t need to call super since this method doesn’t do anything.

Return Value

The string key for which to enable text caching.

Declared In

SLKTextViewController.h

loadView

- (void)loadView
Discussion

Configures view hierarchy and layout constraints. If you override these methods, make sure to call super.

Declared In

SLKTextViewController.h

maximumHeightForAutoCompletionView

- (CGFloat)maximumHeightForAutoCompletionView
Discussion

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

Return Value

The autocompletion view’s max height.

Declared In

SLKTextViewController.h

presentKeyboard:

- (void)presentKeyboard:(BOOL)animated
Discussion

Presents the keyboard, if not already, animated. You can override this method to perform additional tasks associated with presenting the keyboard. You SHOULD call super to inherit some conditionals.

Parameters

animated

YES if the keyboard should show using an animation.

Declared In

SLKTextViewController.h

registerClassForTextView:

- (void)registerClassForTextView:(Class)aClass
Discussion

Registers a class for customizing the behavior and appearance of the text view. You need to call this method inside of any initialization method.

Parameters

aClass

A SLKTextView subclass.

Declared In

SLKTextViewController.h

registerClassForTypingIndicatorView:

- (void)registerClassForTypingIndicatorView:(Class)aClass
Discussion

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.

Parameters

aClass

A UIView subclass conforming to the SLKTypingIndicatorProtocol.

Declared In

SLKTextViewController.h

registerPrefixesForAutoCompletion:

- (void)registerPrefixesForAutoCompletion:(NSArray *)prefixes
Discussion

Registers any string prefix for autocompletion detection, useful for user mentions and/or hashtags autocompletion. The prefix must be valid string (i.e: ‘@’, ‘#’, ‘\’, and so on). This also checks if no repeated prefix are inserted. Prefixes can be of any length.

Parameters

prefixes

An array of prefix strings.

Declared In

SLKTextViewController.h

scrollViewDidEndDecelerating:

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView

scrollViewDidEndDragging:willDecelerate:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

scrollViewDidScroll:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

scrollViewShouldScrollToTop:

- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
Discussion

UIScrollViewDelegate

Declared In

SLKTextViewController.h

setTextInputbarHidden:animated:

- (void)setTextInputbarHidden:(BOOL)hidden animated:(BOOL)animated
Discussion

Changes the visibility of the text input bar. Calling this method with the animated parameter set to NO is equivalent to setting the value of the toolbarHidden property directly.

Parameters

hidden

Specify YES to hide the toolbar or NO to show it.

animated

Specify YES if you want the toolbar to be animated on or off the screen.

Declared In

SLKTextViewController.h

showAutoCompletionView:

- (void)showAutoCompletionView:(BOOL)show
Discussion

Use this method to programatically show/hide the autocompletion view. Right before the view is shown, -reloadData is called. So avoid calling it manually.

Parameters

show

YES if the autocompletion view should be shown.

Declared In

SLKTextViewController.h

textDidUpdate:

- (void)textDidUpdate:(BOOL)animated
Discussion

Notifies the view controller that the text did update. You can override this method to perform additional tasks associated with text changes. You MUST call super at some point in your implementation.

Parameters

If

YES, the text input bar will be resized using an animation.

Declared In

SLKTextViewController.h

textSelectionDidChange

- (void)textSelectionDidChange
Discussion

Notifies the view controller that the text selection did change. Use this method a replacement of UITextViewDelegate’s -textViewDidChangeSelection: which is not reliable enough when using third-party keyboards (they don’t forward events properly sometimes).

You can override this method to perform additional tasks associated with text changes. You MUST call super at some point in your implementation.

Declared In

SLKTextViewController.h

textView:shouldChangeTextInRange:replacementText:

- (BOOL)textView:(SLKTextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
Discussion

SLKTextViewDelegate

Declared In

SLKTextViewController.h

textView:shouldInsertSuffixForFormattingWithSymbol:prefixRange:

- (BOOL)textView:(SLKTextView *)textView shouldInsertSuffixForFormattingWithSymbol:(NSString *)symbol prefixRange:(NSRange)prefixRange
Discussion

Asks the delegate whether the specified formatting symbol should be suffixed, to close the formatting wrap.

@para The prefix range

Declared In

SLKTextView.h

textWillUpdate

- (void)textWillUpdate
Discussion

Notifies the view controller that the text will update. You can override this method to perform additional tasks associated with text changes. You MUST call super at some point in your implementation.

Declared In

SLKTextViewController.h

viewDidAppear:

- (void)viewDidAppear:(BOOL)animated

viewDidDisappear:

- (void)viewDidDisappear:(BOOL)animated

viewDidLayoutSubviews

- (void)viewDidLayoutSubviews

viewDidLoad

- (void)viewDidLoad

viewWillAppear:

- (void)viewWillAppear:(BOOL)animated

viewWillDisappear:

- (void)viewWillDisappear:(BOOL)animated

viewWillLayoutSubviews

- (void)viewWillLayoutSubviews

willRequestUndo

- (void)willRequestUndo
Discussion

Notifies the view controller when the user has shaked the device for undoing text typing. You can override this method to perform additional tasks associated with the shake gesture. Calling super will prompt a system alert view with undo option. This will not be called if ‘undoShakingEnabled’ is set to NO and/or if the text view’s content is empty.

Declared In

SLKTextViewController.h