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 

posted @ 2015-07-28 14:38  我要选李白  阅读(181)  评论(0编辑  收藏  举报