UITable中的UILabel无法显示,但在IOS 7中点击显示(由于背景颜色问题) [英] UILabel in UITable do not get display but get display on click in IOS 7 (due to issue with background colour)
问题描述
-
参考图像编号1:在ios 6和5中,标签在UItable中正确显示。
Referring Image number 1: In ios 6 and 5, the label get display properly in UItable.
参考图像编号2:在IOS 7中,标签不会在UItable中显示。
Referring Image number 2: In IOS 7, the label do not get display in UItable.
参考图像编号3:在iOS 7中,标签在UItable中单击单元格时显示。
Referring Image number 3: In iOS 7, the label get display on click of cell in UItable.
以下是用于在UItable中写入单元格的代码。
Below is the code used to write cell in UItable.
-(UILabel *)createLabel:(UILabel *)sender1 :(int)x :(int)y :(NSString *)title :(int)size :(int)swidth :(int)ht
{
sender1 = [[UILabel alloc] initWithFrame:CGRectMake(x, y, swidth, ht)];
sender1.text = title;
[sender1 setTextColor:[UIColor whiteColor]];
[sender1 setBackgroundColor:[UIColor clearColor]];
[sender1 setFont:[UIFont systemFontOfSize:size]];
sender1.numberOfLines = 2; //7
sender1.lineBreakMode = NSLineBreakByWordWrapping;
sender1.contentMode = UIControlContentVerticalAlignmentCenter;
return sender1;
}
我确定这不是模拟器问题。
I am sure it is not simulator issue.
推荐答案
- 问题在于单元格的默认背景颜色。
-
在Ios 6和5中,它用于设置黑色但在Ios 7中它设置为白色。
- The issue was with the default background colour of the cell.
In Ios 6 and 5 it use to set black but in Ios 7 it is set to White.
[cell setBackgroundColor:[UIColor blackColor]];是解决方案。
[cell setBackgroundColor:[UIColor blackColor]]; is the solution.
这篇关于UITable中的UILabel无法显示,但在IOS 7中点击显示(由于背景颜色问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!