是否可以禁用此按钮?

时间:2017-06-04 14:34:21

标签: ios swift uitableview

如何禁用或隐藏此“登录”按钮。我希望这个“登录”按钮能够点击一次。

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.default, title: "Delete",handler: { (action, indexPath) -> Void in

        if let appDelegate = (UIApplication.shared.delegate as? AppDelegate) {
            let context = appDelegate.persistentContainer.viewContext
            let visitorToDelete = self.fetchResultController.object(at: indexPath)
            context.delete(visitorToDelete)
            appDelegate.saveContext()
        }
    })

    let SigninAction = UITableViewRowAction(style: UITableViewRowActionStyle.default, title: "Signin",handler: { (action, indexPath) -> Void in
        let SigninVC = self.storyboard?.instantiateViewController(withIdentifier: "SigninVC") as! SignatureViewController
        self.present(SigninVC, animated: true, completion: nil)
        let cellID = "Cell"
        let cell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath) as! VisitorTableViewCell
        cell.tag = indexPath.row
        let results = cell.tag
        SigninVC.lastnumber = results
    })
    return [deleteAction,SigninAction]
}

0 个答案:

没有答案