1,在viewDidLoad时,初始化label,代码如下:

 

 UILabel *labelcopy = [[UILabel alloc] initWithFrame:CGRectZero];
labelcopy.textColor = [UIColor redColor];
labelcopy.text = @"123455";
labelcopy.frame = CGRectMake(0,0, 100, 100);
label = labelcopy;
[self.view addSubview:label];
[labelcopy release];

   以上代码运行正常。

但是用以下代码就不能显示

  UILabel *labelcopy = [[UILabel alloc] initWithFrame:CGRectZero];

labelcopy.textColor = [UIColor redColor];
labelcopy.text = @"123455";
labelcopy.frame = CGRectMake(0,0, 100, 100);
label = labelcopy;
  [labelcopy release];
[self.view addSubview:label];

这是label就不能正常显示了。太神奇了,求解答。 

 

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-11-23
  • 2021-06-15
  • 2022-12-23
  • 2021-05-05
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2021-08-23
  • 2022-03-01
  • 2022-12-23
  • 2021-12-16
  • 2021-08-23
相关资源
相似解决方案