Inherits from UITextView
Declared in SLKTextView.h

Tasks

Other Methods

  •   delegate property
  •   placeholder

    The placeholder text string. Default is nil.

    property
  •   placeholderColor

    The placeholder color. Default is lightGrayColor.

    property
  •   maxNumberOfLines

    The maximum number of lines before enabling scrolling. Default is 0 wich means limitless. If dynamic type is enabled, the maximum number of lines will be calculated proportionally to the user preferred font size.

    property
  •   numberOfLines

    The current displayed number of lines.

    property
  •   pastableMediaTypes

    The supported media types allowed to be pasted in the text view, such as images or videos. Default is None.

    property
  •   isExpanding

    YES if the text view is and can still expand it self, depending if the maximum number of lines are reached.

    property
  •   didNotResignFirstResponder

    YES if quickly refreshed the textview without the intension to dismiss the keyboard. @view -disableQuicktypeBar: for more details.

    property
  •   loupeVisible

    YES if the magnifying glass is visible.

    property
  •   trackpadEnabled

    YES if the keyboard track pad has been recognized. iOS 9 only.

    property
  •   typingSuggestionEnabled

    YES if autocorrection and spell checking are enabled. On iOS8, this property also controls the predictive QuickType bar from being visible. Default is YES.

    property
  •   undoManagerEnabled

    YES if the text view supports undoing, either using UIMenuController, or with ctrl+z when using an external keyboard. Default is YES.

    property
  •   dynamicTypeEnabled

    YES if the font size should dynamically adapt based on the font sizing option preferred by the user. Default is YES.

    property
  • – refreshFirstResponder

    Some text view properties don’t update when it’s already firstResponder (auto-correction, spelling-check, etc.) To be able to update the text view while still being first responder, requieres to switch quickly from -resignFirstResponder to -becomeFirstResponder. When doing so, the flag ‘didNotResignFirstResponder’ is momentarly set to YES before it goes back to -isFirstResponder, to be able to prevent some tasks to be excuted because of UIKeyboard notifications.

  • – refreshInputViews
  • – didPressAnyArrowKey:

    Notifies the text view that the user pressed any arrow key. This is used to move the cursor up and down while having multiple lines.

  •   autoCompleteFormatting

    YES if the a markdown closure symbol should be added automatically after double spacebar tap, just like the native gesture to add a sentence period. Default is YES. This will always be NO if there isn’t any registered formatting symbols.

    property
  •   registeredSymbols

    An array of the registered formatting symbols.

    property
  • – registerMarkdownFormattingSymbol:withTitle:

    Registers any string markdown symbol for formatting tooltip, presented after selecting some text. The symbol must be valid string (i.e: ‘*’, ‘~’, ‘_’, and so on). This also checks if no repeated symbols are inserted, and respects the ordering for the tooltip.

SLKAdditions Methods

Properties

autoCompleteFormatting

@property (nonatomic) BOOL autoCompleteFormatting
Discussion

YES if the a markdown closure symbol should be added automatically after double spacebar tap, just like the native gesture to add a sentence period. Default is YES. This will always be NO if there isn’t any registered formatting symbols.

Declared In

SLKTextView.h

delegate

@property (nonatomic, weak) id<SLKTextViewDelegate,UITextViewDelegate> delegate

didNotResignFirstResponder

@property (nonatomic, readwrite) BOOL didNotResignFirstResponder
Discussion

YES if quickly refreshed the textview without the intension to dismiss the keyboard. @view -disableQuicktypeBar: for more details.

Declared In

SLKTextView.h

dynamicTypeEnabled

@property (nonatomic, getter=isDynamicTypeEnabled) BOOL dynamicTypeEnabled
Discussion

YES if the font size should dynamically adapt based on the font sizing option preferred by the user. Default is YES.

Declared In

SLKTextView.h

isExpanding

@property (nonatomic, readonly) BOOL isExpanding
Discussion

YES if the text view is and can still expand it self, depending if the maximum number of lines are reached.

Declared In

SLKTextView.h

loupeVisible

@property (nonatomic, getter=isLoupeVisible) BOOL loupeVisible
Discussion

YES if the magnifying glass is visible.

Declared In

SLKTextView.h

maxNumberOfLines

@property (nonatomic, readwrite) NSUInteger maxNumberOfLines
Discussion

The maximum number of lines before enabling scrolling. Default is 0 wich means limitless. If dynamic type is enabled, the maximum number of lines will be calculated proportionally to the user preferred font size.

Declared In

SLKTextView.h

numberOfLines

@property (nonatomic, readonly) NSUInteger numberOfLines
Discussion

The current displayed number of lines.

Declared In

SLKTextView.h

pastableMediaTypes

@property (nonatomic) SLKPastableMediaType pastableMediaTypes
Discussion

The supported media types allowed to be pasted in the text view, such as images or videos. Default is None.

Declared In

SLKTextView.h

placeholder

@property (nonatomic, copy) NSString *placeholder
Discussion

The placeholder text string. Default is nil.

Declared In

SLKTextView.h

placeholderColor

@property (nonatomic, copy) UIColor *placeholderColor
Discussion

The placeholder color. Default is lightGrayColor.

Declared In

SLKTextView.h

registeredSymbols

@property (nonatomic, readonly) NSArray *registeredSymbols
Discussion

An array of the registered formatting symbols.

Declared In

SLKTextView.h

trackpadEnabled

@property (nonatomic, readonly, getter=isTrackpadEnabled) BOOL trackpadEnabled
Discussion

YES if the keyboard track pad has been recognized. iOS 9 only.

Declared In

SLKTextView.h

typingSuggestionEnabled

@property (nonatomic, getter=isTypingSuggestionEnabled) BOOL typingSuggestionEnabled
Discussion

YES if autocorrection and spell checking are enabled. On iOS8, this property also controls the predictive QuickType bar from being visible. Default is YES.

Declared In

SLKTextView.h

undoManagerEnabled

@property (nonatomic, readwrite) BOOL undoManagerEnabled
Discussion

YES if the text view supports undoing, either using UIMenuController, or with ctrl+z when using an external keyboard. Default is YES.

Declared In

SLKTextView.h

Class Methods

pointSizeDifferenceForCategory:

+ (CGFloat)pointSizeDifferenceForCategory:(NSString *)category
Discussion

Returns a constant font size difference reflecting the current accessibility settings.

Parameters

category

A content size category constant string.

Return Value

A float constant font size difference.

Declared In

SLKTextView+SLKAdditions.h

Instance Methods

didPressAnyArrowKey:

- (void)didPressAnyArrowKey:(id)sender
Discussion

Notifies the text view that the user pressed any arrow key. This is used to move the cursor up and down while having multiple lines.

Declared In

SLKTextView.h

refreshFirstResponder

- (void)refreshFirstResponder
Discussion

Some text view properties don’t update when it’s already firstResponder (auto-correction, spelling-check, etc.) To be able to update the text view while still being first responder, requieres to switch quickly from -resignFirstResponder to -becomeFirstResponder. When doing so, the flag ‘didNotResignFirstResponder’ is momentarly set to YES before it goes back to -isFirstResponder, to be able to prevent some tasks to be excuted because of UIKeyboard notifications.

You can also use this method to confirm an auto-correction programatically, before the text view resigns first responder.

Declared In

SLKTextView.h

refreshInputViews

- (void)refreshInputViews

registerMarkdownFormattingSymbol:withTitle:

- (void)registerMarkdownFormattingSymbol:(NSString *)symbol withTitle:(NSString *)title
Discussion

Registers any string markdown symbol for formatting tooltip, presented after selecting some text. The symbol must be valid string (i.e: ‘*’, ‘~’, ‘_’, and so on). This also checks if no repeated symbols are inserted, and respects the ordering for the tooltip.

Parameters

symbol

A markdown symbol to be prefixed and sufixed to a text selection.

title

The tooltip item title for this formatting.

Declared In

SLKTextView.h

slk_clearText:

- (void)slk_clearText:(BOOL)clearUndo
Discussion

Clears the text.

Parameters

clearUndo

YES if clearing the text should also clear the undo manager (if enabled).

Declared In

SLKTextView+SLKAdditions.h

slk_insertNewLineBreak

- (void)slk_insertNewLineBreak
Discussion

Inserts a line break at the caret’s position.

Declared In

SLKTextView+SLKAdditions.h

slk_insertText:inRange:

- (NSRange)slk_insertText:(NSString *)text inRange:(NSRange)range
Discussion

Adds a string to a specific range.

Parameters

text

The string to be appended to the current text.

range

The range where to insert text.

Return Value

The range of the newly inserted text.

Declared In

SLKTextView+SLKAdditions.h

slk_insertTextAtCaretRange:

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

Inserts a string at the caret’s position.

Parameters

text

The string to be appended to the current text.

Declared In

SLKTextView+SLKAdditions.h

slk_prepareForUndo:

- (void)slk_prepareForUndo:(NSString *)description
Discussion

Registers the current text for future undo actions.

Parameters

description

A simple description associated with the Undo or Redo command.

Declared In

SLKTextView+SLKAdditions.h

slk_scrollToBottomAnimated:

- (void)slk_scrollToBottomAnimated:(BOOL)animated
Discussion

Scrolls to the very end of the content size, animated.

Parameters

animated

YES if the scrolling should be animated.

Declared In

SLKTextView+SLKAdditions.h

slk_scrollToCaretPositonAnimated:

- (void)slk_scrollToCaretPositonAnimated:(BOOL)animated
Discussion

Scrolls to the caret position, animated.

Parameters

animated

YES if the scrolling should be animated.

Declared In

SLKTextView+SLKAdditions.h

slk_wordAtCaretRange:

- (NSString *)slk_wordAtCaretRange:(NSRangePointer)range
Discussion

Finds the word close to the caret’s position, if any.

Parameters

range

Returns the range of the found word.

Return Value

The found word.

Declared In

SLKTextView+SLKAdditions.h

slk_wordAtRange:rangeInText:

- (NSString *)slk_wordAtRange:(NSRange)range rangeInText:(NSRangePointer)rangePointer
Discussion

Finds the word close to specific range.

Parameters

range

The range to be used for searching the word.

rangePointer

Returns the range of the found word.

Return Value

The found word.

Declared In

SLKTextView+SLKAdditions.h