【问题标题】:SWTableviewcell - call animation method without swiping or selectingSWTableviewcell - 无需滑动或选择即可调用动画方法
【发布时间】:2016-06-11 14:24:42
【问题描述】:

我一直在一个项目中使用 SWTableViewCell,但我想让用户知道滑动功能在特定的 UITableview 上可用。我希望通过在加载 tableview 时暂时显示第一个 tableviewcell 的滑动视图动画来做到这一点。因此,例如,表格视图将加载,右侧实用程序按钮将为单元格 0 打开,然后再次暂时隐藏 - 从而向用户显示有一个选项可以滑动单元格以显示“右侧实用程序按钮”。我认为可以通过使用简单的计时器和触发适当的方法来实现这一点。 但是,我需要一些关于调用哪些方法来使其起作用的方向。我尝试了以下方法,但这并没有对动画本身产生影响:

NSIndexPath* indexPath= [NSIndexPath indexPathForRow:0 inSection:0];
GenericTableViewCell6 *cell = (GenericTableViewCell6 *)[self.tableView cellForRowAtIndexPath:indexPath];
[ self swipeableTableViewCell:cell scrollingToState:2];

我已尝试调整此代码以查看是否可以操作动画 - 但此调整再次对我不起作用。

NSIndexPath* indexPath= [NSIndexPath indexPathForRow:0 inSection:0];
GenericTableViewCell6 *cell = (GenericTableViewCell6 *)[self.tableView cellForRowAtIndexPath:indexPath];
[cell showRightUtilityButtonsAnimated:YES];

如果您对此提供任何指导或意见,我将不胜感激。如果您需要任何进一步的信息,请留言。 非常感谢 詹姆斯。

【问题讨论】:

    标签: uitableview animation tableview


    【解决方案1】:

    喝了几杯浓咖啡后,我想出了这个。这是我的解决方案:

    - (void)tableView:(UITableView *)tableView willDisplayCell:(SWTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (indexPath.row== 0) {
            [cell showRightUtilityButtonsAnimated:YES];
    
    
            double delayInSeconds = 2.0;
            dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
            dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
            [cell showLeftUtilityButtonsAnimated:YES];
    
            });
    
        }
    
    }
    

    【讨论】:

      猜你喜欢
      • 2015-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多