1.小项目:加法计算器
--------------- ViewController.m ---------------
#import"ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *num1;
@property (weak, nonatomic) IBOutlet UITextField *num2;
@property (weak, nonatomic) IBOutlet UILabel *reasult;
- (IBAction)plus;
@end
@implementation ViewController
- (IBAction)plus
{
int a = self.num1.text.intValue + self.num2.text.intValue;
self.reasult.text = [NSString stringWithFormat:@"%d", a];
[self.view endEditing:YES];
}
@end