ios - Swift 中的 TableView 提交编辑样式

标签 ios iphone uitableview swift

我有这段代码,我想把它转换成 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 推断 NoneUITableViewCellEditingStyle 枚举的成员。

关于ios - Swift 中的 TableView 提交编辑样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24134231/

相关文章:

iphone - 为什么第二次崩溃?

ios - 如何重置可重复使用细胞的外观?

ios - 为什么核心位置类的 Xcode 代码完成不起作用

ios - 使用 AFNetworking 上传视频导致内存问题

java - 在非 native 应用程序中将号码添加到 iPhone 或 Android 手机联系人列表

IOS CallKit 音频问题

ios - 如何在快速删除行后刷新表格 View ?

ios - 管理图像方向的最佳方法?

ios - 在 Core Data 中加载 csv 文件

iphone - 使用 3.1.3 软件的 NSLog 崩溃应用程序