Skip to content

adonoho/HPGrowingTextView

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 7 commits ahead, 64 commits behind HansPinckaers:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

HPGrowingTextView

Multi-line/Autoresizing UITextView similar to SMS-app. The example project also even looks like Apple's version.

Screenshot

Properties

  • int maxNumberOfLines; – Stops growing at this amount of lines.
  • int minNumberOfLines; – Starts growing at this amount of lines.
  • BOOL animateHeightChange; – Animate the growing

UITextView properties

NSString *text;
UIFont *font;
UIColor *textColor;
UITextAlignment textAlignment;
NSRange selectedRange;
BOOL editable;
UIDataDetectorTypes dataDetectorTypes;
UIReturnKeyType returnKeyType;

Delegate methods

-(BOOL)growingTextViewShouldBeginEditing:(HPGrowingTextView *)growingTextView;
-(BOOL)growingTextViewShouldEndEditing:(HPGrowingTextView *)growingTextView;

-(void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView;
-(void)growingTextViewDidEndEditing:(HPGrowingTextView *)growingTextView;

-(BOOL)growingTextView:(HPGrowingTextView *)growingTextView shouldChangeTextInRange(NSRange)range replacementText:(NSString *)text;
-(void)growingTextViewDidChange:(HPGrowingTextView *)growingTextView;

Called WITHIN animation block!
-(void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height;

Called after animation
-(void)growingTextView:(HPGrowingTextView *)growingTextView didChangeHeight:(float)height;

-(void)growingTextViewDidChangeSelection:(HPGrowingTextView *)growingTextView;
-(BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView;

For more info, see blogpost: http://www.hanspinckaers.com/multi-line-uitextview-similar-to-sms

About

An UITextView which grows/shrinks with the text and starts scrolling when the content reaches a certain number of lines. Similar to the one Apple uses in the SMS-app. See blog-post for a small screencast.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 100.0%