码迷,mamicode.com
首页 > 移动开发 > 详细

ios-计算器

时间:2015-07-28 09:06:38      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

//
//  ViewController.m
//  02加法计算器
//
//  Created by YaguangZhu on 15/7/28.
//  Copyright (c) 2015年 YaguangZhu. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
- (IBAction)jjisuan;
@property (weak, nonatomic) IBOutlet UITextField *txtNum1;
@property (weak, nonatomic) IBOutlet UITextField *txtNum2;
@property (weak, nonatomic) IBOutlet UILabel *lblResult;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)jjisuan {
    NSString *num1 = self.txtNum1.text;
    NSString *num2 = self.txtNum2.text;
    int n1 = num1.intValue;
    int n2 = num2.intValue;
    int result = n1+n2;
    self.lblResult.text = [NSString stringWithFormat:@"%d",result];
}
@end

 

ios-计算器

标签:

原文地址:http://www.cnblogs.com/zhuyaguang/p/4681778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!