Latest 1.0.3
License MIT
Platforms ios 8.0, requires ARC

An NSObject subclass to handle resizing of UITextView as the user types in. The textview resizes as long as the number of lines lies between specified minimum and maximum number of lines.
These are the public properties which can be set from the client code.

  • animationDuration : Default 0.7
  • maximumNumberOfLines : Default INT_MAX
  • minimumNumberOfLines : Default 1


Add following lines in your pod file

pod ‘GrowingTextViewHandler’, ‘~> 1.0.3’


First create an instance of GrowingTextViewHandler. It takes an UITextView and its height constraint as arguments. You can specify the maximum and minimum number of lines. Then in the method "textViewDidChange" call the method resizeTextView

 @interface ViewController ()<UITextViewDelegate>

  @property (weak, nonatomic) IBOutlet UITextView *textView;
  @property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightConstraint;
  @property (strong, nonatomic) GrowingTextViewHandler *handler;


 @implementation ViewController

  - (void)viewDidLoad {
    [super viewDidLoad];
    self.handler = [[GrowingTextViewHandler alloc]initWithTextView:self.textView withHeightConstraint:self.heightConstraint];
    [self.handler updateMinimumNumberOfLines:3 andMaximumNumberOfLine:8];

  - (void)textViewDidChange:(UITextView *)textView {
     [self.handler resizeTextViewWithAnimation:YES];

However when you set text programmatically, *– (void)textViewDidChange:(UITextView )textView** does not get called. For this case you can resize UITextView as follows:

  [self.handler setText: @"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."


Latest podspec

    "name": "GrowingTextViewHandler",
    "platforms": {
        "ios": "8.0"
    "version": "1.0.3",
    "summary": "An NSObject subclass to handle resizing of UITextView as the user types in.",
    "authors": {
        "Susmita Horrow": "[email protected]"
    "license": "MIT",
    "homepage": "",
    "source": {
        "git": "",
        "tag": "1.0.3"
    "source_files": "GrowingTextViewHandler-objc/GrowingTextViewHandler-objc/Source/*",
    "requires_arc": true

Pin It on Pinterest

Share This