-(CGSize)dynamicHeightForTextViewWithFont:(UIFont*)s_font ConstrainSize:(CGSize)s_size{
// UItextView 会有一个padding,为8
// 详情: http://www.1mima.com/uitextview 使用-sizewithfontconstrainedtosizelinebreakmode计算高度不准确的解决方案/
// 维护 bmleung@weiwo.com
CGSize adapter_size = CGSizeMake(s_size.width - 16, s_size.height); // 宽度减去padding,8*2 = 16
CGSize txtContentSize = [self sizeWithFont:s_font constrainedToSize:adapter_size lineBreakMode:UILineBreakModeWordWrap ];
txtContentSize.height += 16; // 高度增加8*2 = 16
return txtContentSize;
}
// UItextView 会有一个padding,为8
// 详情: http://www.1mima.com/uitextview 使用-sizewithfontconstrainedtosizelinebreakmode计算高度不准确的解决方案/
// 维护 bmleung@weiwo.com
CGSize adapter_size = CGSizeMake(s_size.width - 16, s_size.height); // 宽度减去padding,8*2 = 16
CGSize txtContentSize = [self sizeWithFont:s_font constrainedToSize:adapter_size lineBreakMode:UILineBreakModeWordWrap ];
txtContentSize.height += 16; // 高度增加8*2 = 16
return txtContentSize;
}
/link http://www.1mima.com/uitextview使用-sizewithfontconstrainedtosizelinebreakmode计算高度不准确的解决方案/