如果我设置bottomLabel
.text =中文字符,我看不到aboveLabel
当我运行它,如果我调试视图层次结构,我可以看到it.so有什么问题?如何添加UILabel上面的UILabel
UILabel *bottomLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, 200, 40)];
bottomLabel.backgroundColor = [UIColor redColor];
bottomLabel.text = @"中文";
[self.view addSubview:bottomLabel];
UILabel *aboveLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 60, 30)];
aboveLabel.backgroundColor = [UIColor greenColor];
aboveLabel.text = @"aboveLabel";
[bottomLabel addSubview:aboveLabel];
如果我设置bottomLabel.text = @ “ABC” 它工作得很好,我不是很确定你说,你能解释一下吗? – potato
你的上面的标签是底部标签上的Ovelap,所以不显示底部文本。 – Jay
set bottomLabel.text = @“abc”,然后运行,你会看到这两个标签。我的问题是为什么如果我设置bottomLabel.text = @“中文”,我看不到绿色标签? – potato