界面延迟刷新

来源:互联网 发布:怎样安装税控盘软件 编辑:程序博客网 时间:2024/05/22 22:52
/* 
     推迟三秒执行printString方法 
     withObject:传的参数 
     */ 

    [self performSelector:@selector(printString:) withObject:@"Grand Central Dispatch" afterDelay:3.0];


//设置时间为2 
    double delayInSeconds = 2.0; 
    //创建一个调度时间,相对于默认时钟或修改现有的调度时间。 
    dispatch_time_t delayInNanoSeconds =dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 
    //推迟两纳秒执行 
    dispatch_queue_t concurrentQueue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 
    dispatch_after(delayInNanoSeconds, concurrentQueue, ^(void){ 
        NSLog(@"Grand Center Dispatch!"); 
    });


//设置时间 
    double delayInSeconds = 2.0; 
    dispatch_time_t delayInNanoSeconds = 
    dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 
    dispatch_queue_t concurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 
    //调用C函数processSomething 
    dispatch_after_f(delayInNanoSeconds, concurrentQueue, 
                     NULL, 
                     processSomething);




0 0
原创粉丝点击