- html - 我的下拉菜单的内容关闭得太快
- c# - 使用 Html Agility Pack 从网页中的表中获取值而不使用 "SelectNode'
- html - 内容容器下的 CSS 下拉菜单
- html - 如何停止嵌套列表重叠父列表?
我正在使用的方法
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]?
{
let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
//Do something
})
delete.backgroundColor = UIColor.redColor()
let more = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "More" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
//Do something
})
more.backgroundColor = UIColor.blueColor()
return [delete, more]
}
我还包括了
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
// you need to implement this method too or you can't swipe to display the actions
}
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// the cells you would like the actions to appear needs to be editable
return true
}
当我向右或向左滑动时,我创建的按钮没有显示。我尝试在 editactionforrowatindexpath 上放置覆盖,但随后我收到一条错误消息,指出方法未覆盖其父类(super class)中的任何方法
最佳答案
您的实现没有任何问题。该函数未被调用是因为未正确调用委托(delegate)和数据源方法。
您可以通过编程方式或通过 Storyboard连接委托(delegate)和数据源方法。
当您以编程方式实现 TableView 时,您需要在类声明中添加 UITableViewDataSource、UITableViewDelegate 并使用此代码连接委托(delegate)。
yourTableView.datasource = self
yourTableView.delegate = self
如果你是通过storyboard实现tableview,你只需要通过拖拽连接委托(delegate)和数据源方法
关于ios - tableview 方法的问题 func tableView(tableView : UITableView, editActionsForRowAtIndexPath indexPath : NSIndexPath) -> [UITableViewRowAction]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38157219/
我想了解 Ruby 方法 methods() 是如何工作的。 我尝试使用“ruby 方法”在 Google 上搜索,但这不是我需要的。 我也看过 ruby-doc.org,但我没有找到这种方法。
Clear 方法 清除 Err 对象的所有属性设置。 object.Clear object 应为 Err 对象的名称。 说明 在错误处理后,使用 Clear 显式地清除 Err 对象。此
Execute 方法 对指定的字符串执行正则表达式搜索。 object.Execute(string) 参数 object 必选项。总是一个 RegExp 对象的名称。 string
Raise 方法 生成运行时错误 object.Raise(number, source, description, helpfile, helpcontext) 参数 object 应为
Replace 方法 替换在正则表达式查找中找到的文本。 object.Replace(string1, string2) 参数 object 必选项。总是一个 RegExp 对象的名称。
Test 方法 对指定的字符串执行一个正则表达式搜索,并返回一个 Boolean 值指示是否找到匹配的模式。 object.Test(string) 参数 object 必选项。总是一个
BuildPath 方法 向现有路径后添加名称。 object.BuildPath(path, name) 参数 object 必选项。应为 FileSystemObject 对象的名称
Close 方法 关闭打开的 TextStream 文件。 object.Close object 应为 TextStream 对象的名称。 说明 下面例子举例说明如何使用 Close 方
Copy 方法 将指定的文件或文件夹从某位置复制到另一位置。 object.Copy destination[, overwrite] 参数 object 必选项。应为 File 或 F
CopyFile 方法 将一个或多个文件从某位置复制到另一位置。 object.CopyFile source, destination[, overwrite] 参数 object 必选
CopyFolder 方法 将文件夹从某位置递归复制到另一位置。 object.CopyFolder source, destination[, overwrite] 参数 object
CreateFolder 方法 创建文件夹。 object.CreateFolder(foldername) 参数 object 必选项。应为 FileSystemObject 对象的名称
CreateTextFile 方法 创建指定文件并返回 TextStream 对象,该对象可用于读或写创建的文件。 object.CreateTextFile(filename[, overwr
Delete 方法 删除指定的文件或文件夹。 object.Delete force 参数 object 必选项。应为 File 或 Folder 对象的名称。 force 可选项。
DeleteFile 方法 删除指定的文件。 object.DeleteFile filespec[, force] 参数 object 必选项。应为 FileSystemObject
DeleteFolder 方法 删除指定的文件夹和其中的内容。 object.DeleteFolder folderspec[, force] 参数 object 必选项。应为 File
DriveExists 方法 如果指定的驱动器存在,则返回 True;否则返回 False。 object.DriveExists(drivespec) 参数 object 必选项。应为
Exists 方法 如果在 Dictionary 对象中存在指定键,返回 True;如果不存在,返回 False。 object.Exists(key) 参数 object 必选项. 总
FileExists 方法 如果指定的文件存在返回 True;否则返回 False。 object.FileExists(filespec) 参数 object 必选项。应为 FileS
FolderExists 方法 如果指定的文件夹存在,则返回 True;否则返回 False。 object.FolderExists(folderspec) 参数 object 必选项
我是一名优秀的程序员,十分优秀!