Ios 设置标签自定义控件?

Ios 设置标签自定义控件?,ios,uilabel,Ios,Uilabel,我需要手动设置标签控制代码,我有: UILabel* label = [[UILabel alloc] initWithFrame: labelFrame]; [label setText: @"My Label"]; [label setTextColor: [UIColor orangeColor]]; 但运行此代码后,标签没有显示 您遗漏了一行代码[self.view addSubview:label]代码应该像 UILabel* label = [[UILabel alloc] ini

我需要手动设置标签控制代码,我有:

UILabel* label = [[UILabel alloc] initWithFrame: labelFrame];
[label setText: @"My Label"];
[label setTextColor: [UIColor orangeColor]];

但运行此代码后,标签没有显示

您遗漏了一行代码
[self.view addSubview:label]代码应该像

UILabel* label = [[UILabel alloc] initWithFrame: labelFrame];
[label setText: @"My Label"];
[label setTextColor: [UIColor orangeColor]];
[self.view addSubview: label]

您遗漏了一行代码
[self.view addSubview:label]代码应该像

UILabel* label = [[UILabel alloc] initWithFrame: labelFrame];
[label setText: @"My Label"];
[label setTextColor: [UIColor orangeColor]];
[self.view addSubview: label]

将其作为子视图添加到现有视图中

[self.view addSubview:label];

将其作为子视图添加到现有视图中

[self.view addSubview:label];