1

基本上我的简单问题是以编程方式创建的 UILabel没有出现在 IOS 7 模拟器中,但它适用于 IOS 6 模拟器,我正在使用情节提要

我的代码是:

 UILabel *lbl_top = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 100)];
    lbl_top.text = text;
    lbl_top.font = customFont;
    lbl_top.numberOfLines = 1;
    lbl_top.baselineAdjustment = UIBaselineAdjustmentAlignBaselines; 
    lbl_top.adjustsFontSizeToFitWidth = YES;
    lbl_top.adjustsLetterSpacingToFitWidth = YES;
    lbl_top.minimumScaleFactor = 10.0f/12.0f;
    lbl_top.clipsToBounds = YES;
    lbl_top.backgroundColor = [UIColor clearColor];
    lbl_top.textColor = [UIColor blackColor];
    lbl_top.textAlignment = NSTextAlignmentLeft;
    lbl_top.hidden = FALSE;
    lbl_top.alpha = 1.0;
    [self.view addSubview:lbl_top];

控制台打印:

lbl_top 的打印说明:

UILabel: 0x8dae430; 帧 = (10 100; 100 100); text = '电源问题 - Power Surv...'; clipsToBounds = YES; 用户交互启用 = 否;层=CALayer:0x8db5f30

在 IOS 6 模拟器中

在 IOS 6 模拟器中

在 IOS 7 模拟器中

在 IOS 7 模拟器中

4

2 回答 2

1
try this code 

UILabel *lbl_top = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 100)];
lbl_top.text = @"agssudass ";
lbl_top.font = [UIFont systemFontOfSize:15.0];
lbl_top.numberOfLines = 1;
lbl_top.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;
lbl_top.adjustsFontSizeToFitWidth = YES;
lbl_top.adjustsLetterSpacingToFitWidth = YES;
lbl_top.minimumScaleFactor = 10.0f/12.0f;
lbl_top.clipsToBounds = YES;
lbl_top.backgroundColor = [UIColor blackColor];
lbl_top.textColor = [UIColor whiteColor];
lbl_top.textAlignment = NSTextAlignmentLeft;
lbl_top.hidden = FALSE;
lbl_top.alpha = 1.0;
[self.view addSubview:lbl_top];

变化是

lbl_top.text = @"agssudass ";
lbl_top.backgroundColor = [UIColor blackColor];
lbl_top.font = [UIFont systemFontOfSize:15.0]; 
lbl_top.textColor = [UIColor whiteColor];
于 2013-10-12T07:22:48.477 回答
0

我认为您没有正确设置该标签的文本。将文本设置为

lolabel.text = @"Welcome";

并且一旦检查您的字体也可能是您的字体不支持iOS 7. 一旦将字体更改为默认字体并检查它。

于 2014-05-14T11:21:51.800 回答