在下面的代码中我有tableview委托,但最初我选择一行我想在editActionsForRowAt中的动作返回一个空数组。所以基本上如何调用editActionsForRowAt函数并返回空的nil?
代码如下:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
var action:[UITableViewRowAction] = []
let update = UITableViewRowAction(style: .default, title: "Update", handler: { (action, indexPath) -> Void in
DemosClient.sharedInstance.sendIdwhenUpdate()
// let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoadingScreenController") as! LoadingScreenController
tableView.isHidden = true
self.progressView.isHidden = false
self.self.progressIndicatorView.isHidden = false
self.startTimer()
DemosClient.sharedInstance.updatePackage2()
.then { response -> Void in
print(response)
}
.catch { error in
print(error)
}
})
update.backgroundColor = UIColor.lightGray
action = [update]
return action
}
答案 0 :(得分:1)
您可以使用$('input[type="number"], input[type="text"]').keyup(function(e) {
this.value = this.value.replace(/[^0-9-]/i, '');
})
并将var cultureInfo = new CultureInfo("it-IT");
CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
与canEditRowAt
indexPath
进行比较,如果匹配则返回indexPathForSelectedRow
,否则返回tableView
。有了这些,您将返回false
,它将不会调用true
,因此无需对其进行任何更改。
false