我有这段代码,我想把它转换成 swift 代码。
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}
我默认得到一个删除编辑样式,我想要无样式。 提前致谢。!!
最佳答案
您可以通过命令单击 Swift 源文件或 Playground 中的 UITableViewDelegate
标识符来获取方法的正确声明。这使得 Xcode 向您显示 UITableView.h
的 Swift 化版本。在那里,您可以搜索 editingStyleForRowAtIndexPath
以找到确切的方法签名。一旦你有了它,剩下的就很简单了:
func tableView(tableView: UITableView!, editingStyleForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCellEditingStyle {
return .None
}
请注意,由于方法声明的返回类型,Swift 推断 None
是 UITableViewCellEditingStyle
枚举的成员。
关于ios - Swift 中的 TableView 提交编辑样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24134231/