Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以编程方式创建的UILabel未出现在IOS 7情节提要中_Ios_Objective C_Ios6_Storyboard_Ios7 - Fatal编程技术网

以编程方式创建的UILabel未出现在IOS 7情节提要中

以编程方式创建的UILabel未出现在IOS 7情节提要中,ios,objective-c,ios6,storyboard,ios7,Ios,Objective C,Ios6,Storyboard,Ios7,基本上,我的简单问题是通过编程创建的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_

基本上,我的简单问题是通过编程创建的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_顶部的打印说明:

UILabel:0x8dae430;帧=(10100;100100);text='电源问题-电源电压…';clipsToBounds=是;userInteractionEnabled=否;层=层:0x8db5f30

在ios6模拟器中

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];

在iOS7模拟器中

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];
变化是

lbl_top.text = @"agssudass ";
lbl_top.backgroundColor = [UIColor blackColor];
lbl_top.font = [UIFont systemFontOfSize:15.0]; 
lbl_top.textColor = [UIColor whiteColor];

我想你没有正确设置标签的文字。 将文本设置为

lolabel.text = @"Welcome";
并且一旦检查您的字体,也可能是您的字体在iOS 7中不支持。
一旦将字体更改为默认字体并签出。

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

lolabel.text = @"Welcome";
并且一旦检查您的字体,也可能是您的字体在iOS 7中不支持。
一旦将字体更改为默认字体并签出。

您确定这些图像的代码正确吗?我看不到黑色背景。另外,iOS 7上也不推荐使用“adjustsLetterSpacingToFitWidth”。@Odrakir抱歉,我编辑了在iOS 7上工作的内容。您生成自定义字体或文本的代码可能有问题。@Odrakir我发现问题在于ViewWill在IOS 6上工作,但在IOS 7上不工作感谢您提供了查看提示加载功能。您确定这是用于这些图像的正确代码吗?我看不到黑色背景。另外,iOS 7上也不推荐使用“adjustsLetterSpacingToFitWidth”。@Odrakir抱歉,我编辑了在iOS 7上工作的内容。您生成自定义字体或文本的代码可能有问题。@Odrakir我发现问题在于ViewWill在IOS 6上工作,但在IOS 7上不工作。感谢您提供了view didLoad函数的线索