UITExtView代替uilabel 自适应文本的高度

NSString *filePathA = [[NSBundle mainBundle] pathForResource:@"a" ofType:@"txt"];
    NSString *s = [NSString stringWithContentsOfFile:filePathA encoding:NSUTF8StringEncoding error:nil];

 

UITextView *textview = [[UITextView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 500)];
    textview.font = [UIFont fontWithName:@"Helvetica" size:17.000];
    textview.text = s;
    textview.userInteractionEnabled = YES;
    textview.editable = NO;
    textview.contentSize = CGSizeMake(320,500);
    [self addSubview:textview];

 

你可能感兴趣的:(UITExtView代替uilabel 自适应文本的高度)