//UILabel自动换行
1.方法一(好用)
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.font = [UIFont systemFontOfSize:14];
NSString *titleContent = @"这是一段很长的话,此处省略500字,这是一段很长的话,此处省略500字,这是一段很长的话,此处省略500字";
titleLabel.text = titleContent;
titleLabel.numberOfLines = 0;//多行显示,
//计算高度
CGSize titleSize = [titleContent boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;
titleLabel.frame = CGRectMake(0, 400, titleSize.width,titleSize.height);
[self.view addSubview:titleLabel];