Ios 如何在用户滑动并查看时更新UITableView单元格';删除';按钮

Ios 如何在用户滑动并查看时更新UITableView单元格';删除';按钮,ios,uitableview,timer,Ios,Uitableview,Timer,我有UITableVIew表 我在UITableViewDataSource协议的方法tableView:committeditingstyle:forrowatinexpath:中实现了删除 这里一切都很好。 这是一个很有用的问题 但每个单元格都显示倒计时,我对此有异议 我以以下方式使用NSTimer: timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(updateTi

我有
UITableVIew

我在
UITableViewDataSource
协议的方法
tableView:committeditingstyle:forrowatinexpath:
中实现了删除

这里一切都很好。 这是一个很有用的问题

但每个单元格都显示倒计时,我对此有异议

我以以下方式使用
NSTimer

timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self
    selector:@selector(updateTickerHandler:) userInfo:nil repeats:YES];
- (void)updateTickerHandler:(NSTimer*)timer
{
    [tableView beginUpdates];


    // select visible cells only which we will update 
    NSArray *visibleIndices = [tableView indexPathsForVisibleRows];

    // iterate through visible cells
    for (NSIndexPath *visibleIndex in visibleIndices)
    {
        MyTableCell *cell = (MyTableCell*)
            [tableView cellForRowAtIndexPath:visibleIndex];

        // add here code to fill `cell` with actual values
        // visibleIndex can be used to retrieve corresponding data

        ...
    }

    [tableView endUpdates];
}

当用户滑动删除计时器时,
[tableView reloadData]时,“删除”按钮消失已调用

我想实现更新表单元格上的计时器倒计时值,这允许用户顺利地使用“删除”滑动


如何实现这一点?

我无法通过呼叫获得工作行为:

 - (void)updateTickerHandler:(NSTimer*)timer
{
 [Table beginUpdates];
 [Table reloadData];
 [Table endUpdates];
}
[tableView reloadData];
工作解决方案是手动更新单元组件,而不是调用
[表重载数据]

UpdatecKerHandler:的代码可以通过以下方式更新:

timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self
    selector:@selector(updateTickerHandler:) userInfo:nil repeats:YES];
- (void)updateTickerHandler:(NSTimer*)timer
{
    [tableView beginUpdates];


    // select visible cells only which we will update 
    NSArray *visibleIndices = [tableView indexPathsForVisibleRows];

    // iterate through visible cells
    for (NSIndexPath *visibleIndex in visibleIndices)
    {
        MyTableCell *cell = (MyTableCell*)
            [tableView cellForRowAtIndexPath:visibleIndex];

        // add here code to fill `cell` with actual values
        // visibleIndex can be used to retrieve corresponding data

        ...
    }

    [tableView endUpdates];
}

我无法通过电话了解工作行为:

[tableView reloadData];
工作解决方案是手动更新单元组件,而不是调用
[表重载数据]

UpdatecKerHandler:的代码可以通过以下方式更新:

timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self
    selector:@selector(updateTickerHandler:) userInfo:nil repeats:YES];
- (void)updateTickerHandler:(NSTimer*)timer
{
    [tableView beginUpdates];


    // select visible cells only which we will update 
    NSArray *visibleIndices = [tableView indexPathsForVisibleRows];

    // iterate through visible cells
    for (NSIndexPath *visibleIndex in visibleIndices)
    {
        MyTableCell *cell = (MyTableCell*)
            [tableView cellForRowAtIndexPath:visibleIndex];

        // add here code to fill `cell` with actual values
        // visibleIndex can be used to retrieve corresponding data

        ...
    }

    [tableView endUpdates];
}

这并不能解决问题。“表”是什么意思?这并不能解决问题。“桌子”是什么意思?