ios – 如何在Popover中禁用TableView中的动画?

我点击一个单元格时会出现一个弹出窗口.在这个popover中,有一个带有行的TableView.当我单击该行时,会出现三个带动画的新行.我想删除那个动画.可能吗 ?

这是我的代码:

extension PlanningActionTableViewController
{
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        return numberOfRows()
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        let cell = tableView.dequeueReusableCellWithIdentifier("ActionCell", forIndexPath: indexPath) as!PlanningActionCell


        // Info cells
        if registration == nil
        {
            if slot.registrations.count > indexPath.row
            {
                let contact = slot.registrations[indexPath.row].contact
                let name = contact.lastname + " " + contact.firstname
                cell.actionLabel.text = (name.characters.count > 1 ? name : "Réservation en cours")
                cell.accessoryType = .DisclosureIndicator
                cell.imageSymbol.image = UIImage(named: "picto.user.default")

                return cell
            }

            cell.actionLabel.text = "Ajouter"
            cell.accessoryType = .None
            cell.imageSymbol.image = UIImage(named: "picto.user.add")

            return cell

        }

        // Actions cell
        switch indexPath.row
        {
        case 0:
            cell.actionLabel.text = "Détails"
            cell.accessoryType = .None
            cell.imageSymbol.image = UIImage(named: "picto.user.details")

        case 1:
            var state = "Non"
            if let contact = registration?.contact
            {
                state = (contact.isArrived ? "Oui" : "Non")
            }

            cell.actionLabel.text = "Est arrivé: " + state
            cell.accessoryType = .None
            cell.imageSymbol.image = UIImage(named: "picto.user.valid")

        default:
            cell.actionLabel.text = "Supprimer booking"
            cell.actionLabel.textColor = UIColor.redColor()
            cell.imageSymbol.image = UIImage(named: "picto.user.delete")
            cell.accessoryType = .None
        }

        return cell
    }
}

NumberOfRows:

func numberOfRows() -> Int
{
    if registration == nil
    {
        return slot.subslotsCount
    }

    return 3
}

视频示例:

<iframe src="//gifs.com/embed/1wvE6R" frameborder="0" scrolling="no" width='480' height='220.7665505226481' style="-webkit-backface-visibility: hidden;-webkit-transform: scale(1);" ></iframe>

最佳答案 在viewDidLoad中,将动画设置为false:

UIView.setAnimationsEnabled(false)
点赞