[英]Change UILabel text storyboard programmatically
I would like to change UILabel
on press the UIButton
. 我想在按下UIButton
更改UILabel
。 I need to load screen before, but how can I do it in storyboard? 我需要先加载屏幕,但是如何在情节提要中加载屏幕? Now code is something like this: 现在代码是这样的:
Code here (.h file): 此处的代码(.h文件):
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UILabel *idLabel; // label to change
@property (strong, nonatomic) IBOutlet UIButton *addingButton; // clickOnButton
@end
And method (.m file): 和方法(.m文件):
- (IBAction)addingHasTaped:(id)sender {
NetworkConnection *request = [[NetworkConnection alloc]init];
[request getDataFromServer];
self.idLabel.text = @"hi!";
}
I use storyboard and I drag and drop UILabel
and UIButton
to code. 我使用情节提要,将UILabel
和UIButton
拖放到代码中。 But this method doesn't change UILabel
. 但是此方法不会更改UILabel
。
What is wrong? 怎么了?
我认为您应该具有标签的合成属性,并且还要检查您的方法是否获得Call。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.