延时刷新表

来源:互联网 发布:mac怎么用不了itools 编辑:程序博客网 时间:2024/05/23 21:12

    int64_t delayInSeconds = 2.0;

    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);

    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){

        [weakSelf.tableView beginUpdates];

        [weakSelf.dataSource insertObject:[NSDate date] atIndex:0];

        [weakSelf.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationBottom];

        [weakSelf.tableView endUpdates];

        [weakSelf.tableView.pullToRefreshView stopAnimating];

    });

0 0
原创粉丝点击