所以,我一直在努力学习 iOS 的 Objective-C 编程的基础知识。现在我需要在框架中放置一个简单的按钮以及一个标签。我得到了标签,但我不确定按钮代码有什么问题。
编码:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(25, 25, 275, 60)];
label.text = test;//@"I am learning Objective-C for the\n very first time!";
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;
//label.lineBreakMode = NSLineBreakByWordWrapping; //iOS 6 only
[self.view addSubview:label];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(25, 100, 275, 40)];
button.titleLabel.text = @"Hello";
[self.view addSubview:button];
按钮不显示...