TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2016 |
Maintained by Zachary West.
ZSWSuffixTextView is a UITextView
subclass which supports:
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.
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.
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
).
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.
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.
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
ZSWSuffixTextView is available under the MIT license.