1.效果图
2.View层级
UIView ==> UIScrollView ==> UIView ==> UILabel
注意:1.UIScrollView里需要放一个UIView
2.UIScrollView里UIView高度错误问题到Label自动布局完自动OK
3.代码
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableString *mutableString=[[NSMutableString alloc]init];
for(int i=1;i<=48;i++){
[mutableString appendFormat:[NSString stringWithFormat:@"%@.%@\n",[NSString stringWithFormat:@"%d",i],@"=====测试测试====="]];
}
_label.text= [mutableString substringToIndex:[mutableString length]-1];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end