UIView *contentView = [[UILabel alloc] initWithFrame:self.view.bounds];
contentView.backgroundColor = [UIColor whiteColor];//注释该行下面的文本可以显示
[self.view addSubview:_commentListView];
UILabel *label = [[UILabel alloc] initWithFrame:contentView.bounds];
label.text = @"123";
[_commentListView addSubview:label];
遇到一个神奇的问题,注释第二行,文本可见;加上第二行,则文本不可见。
最后发现问题,第一行要改为 UIView *contentView = [[UIView alloc] initWithFrame:self.view.bounds];