zoukankan      html  css  js  c++  java
  • iOS_1_加法器

    :




    BeyondViewController.h

    //
    //  BeyondViewController.h
    //  01_calc
    //
    //  Created by beyond on 14-7-20.
    //  Copyright (c) 2014 com.beyond. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface BeyondViewController : UIViewController
    // IBOutlet IBAction,,storyboard
    
    // ,
    @property (nonatomic,weak) IBOutlet UITextField *num1;
    @property (nonatomic,weak) IBOutlet UITextField *num2;
    
    @property (nonatomic,weak) IBOutlet UILabel *result;
    
    
    
    // button 
    - (IBAction)btnClick:(UIButton *)sender;
    @end
    

    BeyondViewController.m

    //
    //  BeyondViewController.m
    //  01_calc
    //
    //  Created by beyond on 14-7-20.
    //  Copyright (c) 2014 com.beyond. All rights reserved.
    //
    
    #import "BeyondViewController.h"
    
    @interface BeyondViewController ()
    
    @end
    
    @implementation BeyondViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    	
    }
    #pragma mark - button,
    // button 
    - (IBAction)btnClick:(UIButton *)sender
    {
        // viewson
        NSLog(@"view%dson",self.view.subviews.count);
        
        // buttontag4
        if (4==sender.tag) {
            NSLog(@"button %@",sender);
            
            // 1,,2,self
            // UITextField *textField1=_num1;
            NSString *n1=self.num1.text;
            NSString *n2=self.num2.text;
            NSLog(@"1 %@ 2 %@",n1,n2);
            
            int result=[n1 intValue]+[n2 intValue];
            self.result.text=[NSString stringWithFormat:@"%d",result];
        }
        
        switch ([sender tag]) {
            case 1:
                NSLog(@"tag1button");
                break;
            case 2:
                NSLog(@"tag2button");
                break;
            default:
                break;
        }
        
        // BeyondViewController
        NSLog(@"self  %@",self);
       
        [_num1 resignFirstResponder];
        [_num2 resignFirstResponder];
    }
    
    
    @end
    










  • 相关阅读:
    工业大数据的理论体系
    我的偶像王坚博士,一位执着的学者!
    云计算遇上区块链,会产生怎样的能量和火花?
    管好超时才能做好异步
    “AliOS之父”——阿里巴巴王坚博士
    Centos7开放及查看端口
    直连不同网段
    实施:帧中继
    网线标准
    以太网的帧结构
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4556030.html
Copyright © 2011-2022 走看看