UITextView自适应高度

- (float) heightForTextView: (UITextView *)textView WithText: (NSString *) strText{

    float fPadding = 10.0;

    CGSize constraint = CGSizeMake(textView.contentSize.width - fPadding, CGFLOAT_MAX);

    

    CGSize size = [strText sizeWithFont: textView.fontconstrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];

    

    float fHeight = size.height + 5.0;

    

    return fHeight;

}

posted @ 2013-08-09 14:16  cocoajin  阅读(239)  评论(0编辑  收藏  举报