Skip to content
This repository was archived by the owner on Apr 22, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions class/HPGrowingTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
//uitextview properties
@property(unsafe_unretained) NSObject<HPGrowingTextViewDelegate> *delegate;
@property(nonatomic,strong) NSString *text;
@property(nonatomic,strong) NSAttributedString *attributedText;
@property(nonatomic,strong) UIFont *font;
@property(nonatomic,strong) UIColor *textColor;
@property(nonatomic) NSTextAlignment textAlignment; // default is NSTextAlignmentLeft
Expand Down
26 changes: 20 additions & 6 deletions class/HPGrowingTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,30 @@ -(BOOL)isFirstResponder

-(void)setText:(NSString *)newText
{
internalTextView.text = newText;
// include this line to analyze the height of the textview.
// fix from Ankit Thakur
[self performSelector:@selector(textViewDidChange:) withObject:internalTextView];
internalTextView.text = newText;

// include this line to analyze the height of the textview.
// fix from Ankit Thakur
[self performSelector:@selector(textViewDidChange:) withObject:internalTextView];
}

-(NSString*) text
{
return internalTextView.text;
return internalTextView.text;
}

-(void)setAttributedText:(NSAttributedString *)newText
{
internalTextView.attributedText = newText;

// include this line to analyze the height of the textview.
// fix from Ankit Thakur
[self performSelector:@selector(textViewDidChange:) withObject:internalTextView];
}

-(NSAttributedString*) attributedText
{
return internalTextView.attributedText ?: [[NSAttributedString alloc] initWithString:self.text];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down