Skip to content

Commit

Permalink
Work around iOS 7's broken UITextView height calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Sep 16, 2013
1 parent 0a7a4df commit 9776db6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions IRCCloud/UIExpandingTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ -(void)setMinimumNumberOfLines:(int)m
minimumNumberOfLines = m;
}


- (void)textViewDidChange:(UITextView *)textView
{
if(textView.text.length == 0) {
Expand All @@ -212,7 +211,7 @@ - (void)textViewDidChange:(UITextView *)textView
placeholderLabel.alpha = 0;
}

NSInteger newHeight = internalTextView.contentSize.height;
NSInteger newHeight = ([[[[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."] objectAtIndex:0] intValue] < 7)?internalTextView.contentSize.height:[textView.text sizeWithFont:textView.font constrainedToSize:CGSizeMake(internalTextView.bounds.size.width - 12, maximumHeight) lineBreakMode:NSLineBreakByWordWrapping].height + 17;

if(newHeight < minimumHeight || !internalTextView.hasText)
{
Expand Down

0 comments on commit 9776db6

Please sign in to comment.