zsw

ZSWSuffixTextView

UITextView subclass which displays a suffix after editable text and a placeholder.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

50

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

0

License

MIT

Categories

Readme

ZSWSuffixTextView

Version License Platform

ZSWSuffixTextView is a UITextView subclass which supports:

  • Suffix text, appended after the editable area
  • Placeholder text, for when nothing has been entered

You can use either of these independently, or together. This is done without modifying any text so your delegates do not need modification for text processing. It's a drop-in replacement.

You can view the header file for more detailed documentation on configuration, or view the example project for general usage.

Placeholder

You can set placeholder text and text color. Other attributes for the placeholder text are inherited from the text view.

var placeholderTextColor: UIColor! // defaults to 70% black
var placeholder: String?

You may update the placeholder text at any time.

Suffix text

You can set an NSString or NSAttributedString version of the suffix text. By default, the font and color attributes are inherited from the text view.

var suffixTextColor: UIColor! // defaults to same as text
var suffix: String?
var attributedSuffix: NSAttributedString?
var suffixSpacing: CGFloat

If you use an attributed version, be aware that the NSParagraphStyle will be modified (or added) to handle positioning (via firstLineHeadIndent) and forced right-to-left (via baseWritingDirection).

A good way to generate your suffix text, especially when you want sub-string coloring, is to use ZSWTaggedString which allows generating attributed strings easily.

Tappable

With the Tappable subspec, this class uses ZSWTappableLabel. This allows regions of your suffix text to be tappable, similar to the Facebook status updating screen. This is done via two exposed properties:

var suffixTapDelegate: ZSWTappableLabelTapDelegate?
var suffixLongPressDelegate: ZSWTappableLabelLongPressDelegate?

For more information on setting up tappable regions, refer to the documentation for the tappable label.

Right-to-left

ZSWSuffixTextView supports right-to-left text input for the placeholder and the suffix text.

If you provide left-to-right text for either, they are forced to behave like right-to-left.

Installation

ZSWSuffixTextView is available through CocoaPods. To install it, simply add the following line(s) to your Podfile:

pod "ZSWSuffixTextView", "~> 1.0"
pod "ZSWSuffixTextView/Tappable", "~> 1.0" # for tap support

License

ZSWSuffixTextView is available under the MIT license.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial