快速旋转UIContextualAction

时间:2018-07-30 17:05:36

标签: uitableview swift4 rotatetransform uicontextualaction

我试图进行聊天,我找到了使tableView看起来像是用下面的代码行从底部填充到顶部的方法:

//Swipe the tableView
tableView.transform = CGAffineTransform(rotationAngle: (-.pi))
tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 0, tlView.bounds.size.width - 10)
//Swipe the cells
cell.transform = CGAffineTransform(rotationAngle: (-.pi))

这很好用,但是当您使用函数TrailingSwipeActionsConfigurationForRowAt应用动作时,会出现问题,因为一切都颠倒了,如下图所示。如您所见,“详细信息”按钮位于右侧(必须位于左侧),并且其上下颠倒。

Image

这是执行操作的函数,但是UIContextualAction没有函数转换,因此不能将其作为表视图和单元格旋转。

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

        let answerAction = UIContextualAction(style: .normal, title:  "Details", handler: { (ac:UIContextualAction, view:UIView, success: @escaping (Bool) -> Void) in
            success(true)
        })

        answerAction.backgroundColor = UIColor.white.withAlphaComponent(0)

        let configuration = UISwipeActionsConfiguration(actions: [answerAction])
        configuration.performsFirstActionWithFullSwipe = true

        return configuration

}

那么,我该如何旋转?或还有什么其他方法可以使tableView从botton填充到顶部?

非常感谢您的帮助!

0 个答案:

没有答案
相关问题