• 定时器


    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
       // self.view.backgroundColor = [UIColor orangeColor];
    
        UIButton* btnStart = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        btnStart.frame = CGRectMake(100, 100, 50, 50);
        [btnStart setTitle:@"start" forState:UIControlStateNormal];
        [btnStart addTarget:self action:@selector(pressStart) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:btnStart];
        
        
        UIButton* btnStop = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        btnStop.frame = CGRectMake(100, 200, 50, 50);
        [btnStop setTitle:@"stop" forState:UIControlStateNormal];
        [btnStop addTarget:self action:@selector(pressStop) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:btnStop];
        
        UIView* view = [[UIView alloc]init];
        view.frame = CGRectMake(0,0,80,80);
        view.backgroundColor = [UIColor redColor];
        
        [self.view addSubview:view];
        view.tag = 101;
        
        
        
        
    
    }
    
    -(void) pressStart
    {
        //NSLog(<#NSString * _Nonnull format, ...#>);
        _timerView =  [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(updateTimer:) userInfo:@"Li" repeats:YES];
        
        
    }
    -(void) pressStop
    {
        if(_timerView!=nil){
            [_timerView invalidate];
        }
        
    }
    -(void) updateTimer:(NSTimer*) timer
    {
        NSLog(@"Test name =%@",timer.userInfo);
        UIView *view = [self.view viewWithTag:101];
        view.frame = CGRectMake(view.frame.origin.x+1, view.frame.origin.y+1, 50, 50);
        
    }
  • 相关阅读:
    音乐情感识别
    SoftmaxWithLoss函数和师兄给的loss有哪些区别呢
    内积层和全连接层是一样的
    caffe中的Local Response Normalization (LRN)有什么用,和激活函数区别
    caffe官网的部分翻译及NG的教程
    couldn't import dot_parser
    apt-get -f install
    Spring常用注解总结 hibernate注解
    Set Map List Iterator
    iframe 与frameset
  • 原文地址:https://www.cnblogs.com/vector11248/p/7577100.html
Copyright © 2020-2023  润新知