The following code helps to find the height for a UILabel or UITextView

NSString *text = @"This is a sample text";
    CGSize maxSize = CGSizeMake(maxWidth, FLT_MAX);
    CGRect labelRect = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil];
    CGFloat height = labelRect.size.height;