Skip to content

Commit

Permalink
adding default height to text view element
Browse files Browse the repository at this point in the history
  • Loading branch information
atomkirk committed May 23, 2015
1 parent ac57162 commit a2dadea
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions MYSForms/MYSForms/MYSFormTextViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ + (CGSize)sizeRequiredForElement:(MYSFormTextViewElement *)element width:(CGFloa
width -= 13;

NSString *currentModelValue = [element transformedModelValue];
CGSize size = [currentModelValue boundingRectWithSize:CGSizeMake(width, FLT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{
NSFontAttributeName : theme.inputTextFont
}
context:nil].size;
CGSize size;
if ([currentModelValue length] > 0) {
size = [currentModelValue boundingRectWithSize:CGSizeMake(width, FLT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{
NSFontAttributeName : theme.inputTextFont
}
context:nil].size;
size.height += 16;
}
else {
size = CGSizeMake(width, 150);
}
size.height = ceil(size.height) + insets.top + insets.bottom;

return size;
Expand Down

0 comments on commit a2dadea

Please sign in to comment.