UITextView ios7

UITextView *textView2 = [[UITextView alloc]initWithFrame:CGRectMake(0, textView1.frame.size.height + 60, 495,20)];
        textView2.backgroundColor = [UIColor clearColor];
        textView2.textColor = [UIColor blackColor];
        textView2.font= [UIFont systemFontOfSize:19];
        [scrollView addSubview:textView2];
        [textView2 release];
        textView2.text = [NSString stringWithFormat:@"%@
%@",[dataDic objectForKey:@"retweeted_status_user_name"],[dataDic objectForKey:@"retweeted_status_text"]];
        
        CGRect txtFrame1;
        if(IOS7BC){
            txtFrame1 = textView2.frame;
            txtFrame1.size.height =[[NSString stringWithFormat:@"%@
 ",textView2.text]
                                   boundingRectWithSize:CGSizeMake(txtFrame1.size.width, CGFLOAT_MAX)
                                   options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
                                   attributes:[NSDictionary dictionaryWithObjectsAndKeys:textView2.font,NSFontAttributeName, nil] context:nil].size.height;
            textView2.frame = txtFrame1;
        }else
        {
            textView2.editable = NO;
            textView2.scrollEnabled= NO;
            [scrollView addSubview:textView2];
            CGSize size02 = textView2.contentSize;
            CGRect frame02 = textView2.frame;
            frame02.size = size02;
            textView2.frame=frame02;
        }
原文地址:https://www.cnblogs.com/jiackyan/p/3438262.html