上面的通过代码实现:
NSString *str = @"字符串大小字符串大小字符串大小字符串大小";
UIFont *font = [UIFont fontWithName:@"Arial" size:50.0f];
CGSize size = CGSizeMake(320, 2000);
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
[label setNumberOfLines:0];
CGSize labelSize = [str sizeWithFont:font
constrainedToSize:size
lineBreakMode:UILineBreakModeWordWrap];
label.frame = CGRectMake(0, 0, labelSize.width, labelSize.height);
label.textColor = [UIColor blackColor];
label.font = font;
label.text = str;
[self.view addSubview:label];
下面的通过xib文件的拉控件实现
致力于ios开发