NSString *str = @“eeiieieie”;
UITextView *textView = [[UITextView alloc] init];
[self.view addSubview:textView];
textView.backgroundColor = [UIColor clearColor];
textView.text = str;
textView.scrollEnabled = YES;
textView.font = [UIFont systemFontOfSize:14];
CGSize size = [str sizeWithFont: font constrainedToSize:CGSizeMake(320,500) lineBreakMode:UILineBreakModeWordWrap];
[label setFrame:CGRectMake(0, 20, size.width, size.height)];
textView.userInteractionEnabled = NO;
textView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
本文提供了一个使用 iOS 中 UITextView 控件的简单示例。示例中创建了一个 UITextView 实例,并设置了其基本属性,如背景颜色、是否可滚动、字体大小等。同时展示了如何计算文本的实际尺寸以适配 UITextView 的显示区域。

2214

被折叠的 条评论
为什么被折叠?



