第一个ios程序

1.贴图为快:

2.核心知识

(1)

声明代码:

@property (strong, nonatomic) IBOutlet UILabel *userOutput;
@property (strong, nonatomic) IBOutlet UITextField *userInput;

- (IBAction)setOutput:(id)sender;

实现代码:

@synthesize userOutput;
@synthesize userInput;

void)viewDidUnload

{
[self setUserOutput:nil];//重要知识点,释放内存!!!
[self setUserInput:nil];//
[super viewDidUnload];
// Release any retained subviews of the main view.
}

- (IBAction)setOutput:(id)sender {
self.userOutput.text=self.userInput.text;//点语言方式
//[[self userOutput] setText:[[self userInput] text]];//经典方法调用
}

(2)

可以通过代码实现,也可以通过Interface Builder编辑器实现,主要通过后一种方法实现。

原文地址:https://www.cnblogs.com/hanjun/p/2722017.html