Giter Club home page Giter Club logo

asjexpandabletextview's Introduction

ASJExpandableTextView

UITextView's most obvious omission is the ability to set placeholder text. This class fixes that and provides more. You can make the text view expand and contract according to its content and have a "Done" button over the keyboard to hide it.

alt tag

Installation

CocoaPods is the preferred way to install this library. Add this command to your Podfile:

pod 'ASJExpandableTextView'

Usage

Creating an ASJExpandableTextView is easy. It has a simple interface consisting of four properties which are IBInspectable. This means that they can be set using the interface builder of your choice; xibs or storyboards.

@property (nullable, copy, nonatomic) IBInspectable NSString *placeholder;

Sets the placeholder. Visible when there is nothing typed in the text view.

@property (nullable, strong, nonatomic) IBInspectable UIColor *placeholderTextColor;

Sets the placeholder text color. Will work only when the placeholder is visible.

@property (assign, nonatomic) IBInspectable BOOL isExpandable;

Set this to make the text view expand and contract according to its content.

@property (assign, nonatomic) IBInspectable NSUInteger maximumLineCount;

You can set the number of visible lines of the text view. Default is 4. To use this property, isExpandable must be set to YES.

@property (assign, nonatomic) IBInspectable BOOL shouldShowDoneButtonOverKeyboard;

The "return" key on the keyboard for a UITextView brings a new line, unlike a UITextField where the keyboard gets hidden. Set this property to show a "Done" button over the keyboard which can hide the keyboard.

@property (nullable, copy) DoneTappedBlock doneTappedBlock;

You can handle the event of the keyboard getting hidden using this block. To use this property, shouldShowDoneButtonOverKeyboard must be set to YES.

alt tag

You can create one using just the interface builder, drop in a UITextView and change the class to ASJExpandableTextView.

alt tag

Credits

License

ASJExpandableTextView is available under the MIT license. See the LICENSE file for more info.

asjexpandabletextview's People

Contributors

dalein avatar readmecritic avatar

Watchers

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