GithubHelp home page GithubHelp logo

mitchellporter / autolayouttextviews Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jrg-developer/autolayouttextviews

0.0 0.0 0.0 364 KB

AutoLayoutTextViews subclasses UITextView and adds placeholder text, auto resizing, and keyboard avoiding functionality.

License: Other

Ruby 1.42% Objective-C 98.58%

autolayouttextviews's Introduction

AutoLayoutTextViews

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.

Installation with CocoaPods

The easiest way to add AutoLayoutTextViews to your project is using CocoaPods. Simply add the following to your Podfile:

pod 'AutoLayoutTextViews', '~> 1.0'

Then run pod install as you normally would.

Manual Installation

Alternatively, you can manually include AutoLayoutTextViews in your project by doing the following:

  1. Clone this repo locally onto your computer, or press Download ZIP to simply download the latest master commit.

  2. Drag the AutoLayoutTextViews folder into your project, making sure Copy items into destination group's folder (if needed) is checked.

General Project Structure

AutoLayoutTextViews is architected as follows:

  1. ALPlaceholderTextView subclasses UITextView and adds an optional placeholder property.

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

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

How to Use

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.

Contributing

Patches and feature additions are welcome!

To contribute:

  1. Open a new issue and propose your change- before writing code- to make sure the open source community agrees it's needed.

Make sure to include your rationale for why this change is needed (especially for new method/feature additions).

  1. Fork this repo.

  2. Make your changes.

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

  1. Write in-line documentation comments for your property/method additions.

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.

  1. Submit a pull request, referencing your original issue from (1) above.

  2. Last but not least, sit back and enjoy your awesomeness in helping make your fellow developers' lives a bit easier!

LICENSE

Like EAMTextView and MBAutoGrowingTextView, AutoLayoutTextViews is released under the MIT license. See the LICENSE file for more details.

autolayouttextviews's People

Contributors

jrg-developer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.