TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Aug 2017 |
Maintained by Joshua Greene, Anthony Miller.
AutoLayoutTextViews
subclasses UITextView
and adds placeholder text, auto resizing, and keyboard avoiding functionality.
AutoLayoutTextViews
was inspired in part by Mouhcine El Amine's work on EAMTextView and by Matej Balantič's work on MBAutoGrowingTextView.
Alternatively, you can manually include AutoLayoutTextViews
in your project by doing the following:
Clone this repo locally onto your computer, or press Download ZIP
to simply download the latest master
commit.
Drag the AutoLayoutTextViews
folder into your project, making sure Copy items into destination group's folder (if needed)
is checked.
AutoLayoutTextViews
is architected as follows:
ALPlaceholderTextView
subclasses UITextView
and adds an optional placeholder
property.
ALAutoResizingTextView
subclasses ALPlaceholderTextView
, which gives it a placeholder
property, and adds "auto resizing" behavior- the text view will grow and shrink as the user types.
Note: when you create layout constraints
(either in Interface Builder or in code), make sure that you set the height
and/or bottom
constraints to greater than or equal
. See the AutoLayoutTextViewsDemo
project for an example of how to do this using Interface Builder.
ALKeyboardAvoidingTextView
also subclasses ALPlaceholderTextView
, which gives it a placeholder
property, and adds "keyboard avoiding" behavior- the text view's frame will shrink/expand as the keyboard will show/hide.Simply use ALPlaceholderTextView
, ALAutoResizingTextView
, or ALKeyboardAvoidingTextView
as a replacement for a UITextView
where you the added functionality provided by one of these.
For example usage of each of these, see the AutoLayoutTextViewsDemo
project within this repository.
Note: AutoLayoutTextViewsDemo
uses CocoaPods to add AutoLayoutTextViews
as a dependency. So, you will need to first run pod install
in the AutoLayoutTextViewsDemo
directory.
Patches and feature additions are welcome!
To contribute:
Make sure to include your rationale for why this change is needed (especially for new method/feature additions).
Fork this repo.
Make your changes.
Write unit tests for your changes (as needed). If possible, a TDD approach is best!
If you've never written unit tests before, that's okay!
You can learn by checking out Jon Reid's (@qcoding) excellent website, including a section just about unit testing.
This project is part of the CocoaPods specs repo, which includes appledoc-parsed documentation hosted for each pod on CocoaDocs.
If you're not familar with appledoc, check out Mattt Thompson's (@matt) introductory post about it.
Submit a pull request, referencing your original issue from (1) above.
Last but not least, sit back and enjoy your awesomeness in helping make your fellow developers' lives a bit easier!
Like EAMTextView
and MBAutoGrowingTextView
, AutoLayoutTextViews
is released under the MIT license. See the LICENSE file for more details.