如果我設置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