zoukankan      html  css  js  c++  java
  • 做的东西随便上传

    #import "ShowTimeViewController.h"
    
    @interface ShowTimeViewController ()
    
    @property (weak, nonatomic) IBOutlet UIButton *btnBigen;
    @property (weak, nonatomic) IBOutlet UILabel *lbShowTime;
    
    @property ( nonatomic ) BOOL isRunning ;
    
    @property ( strong , strong) NSTimer *  curtimer ;
    
    @property ( nonatomic) int  curInt ;
    
    @end
    
    @implementation ShowTimeViewController
    
    
    - (IBAction)clickBegin:(id)sender {
        if( self.isRunning)
        {
            //  pause
            [self.curtimer invalidate];
            self.isRunning = NO ;
            
            [self.btnBigen setTitle:@"开始" forState:UIControlStateNormal ] ;
        }else
        {
            //  run
            
            self.isRunning = YES ;
            
         self.curtimer =   [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
            
            [self.btnBigen setTitle:@"暂停" forState:UIControlStateNormal ] ;
        }
    }
    
    -(void) updateTime
    {
        self.curInt ++ ;
        
        int  time =  self.curInt ;
        
        
        int min =  time   /( 1000 * 60  ) ;
        int second =  (time - min * 1000 * 60)  /1000  ;
        int ms =  time - min * 1000 * 60 - second * 1000 ;
        
        self.lbShowTime.text = [NSString stringWithFormat:@"%02d:%02d %03d" , min , second , ms];
    }
    
    
    - (IBAction)clickReset:(id)sender {
       // reset
        [self.curtimer invalidate];
        self.isRunning = NO ;
        self.lbShowTime.text = @"00:00 000" ;
        
        
        [self.btnBigen setTitle:@"开始" forState:UIControlStateNormal ] ;
    }
    
    
    
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
    }
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
  • 相关阅读:
    LCA问题
    CSP2019 J组 游记
    树的直径
    动态规划-背包问题
    Diworth定理
    扫描线算法
    线段树2:区间乘法实现
    线段树1:区间查询和区间加法
    Sys.WebForms.PageRequestManagerParserErrorException: 常见的原因是:通过调用Response.Write()修改相应时,将启用响应筛选器、HttpModules或服务器追踪
    10 套华丽的 CSS3 按钮推荐
  • 原文地址:https://www.cnblogs.com/didiaodexi/p/4668258.html
Copyright © 2011-2022 走看看