所以我在网站上搜索了这个问题的答案,有一些不错的结果,但最近没有任何结果,因为 Xcode 7 不再是测试版,而 swift 2.0 现在是标准。
我使用了以下代码来实现“向左滑动”功能将导致 UITableViewCell 发生某些情况 -
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath){
if editingStyle == UITableViewCellEditingStyle.Delete {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
据我所知,这是 Apple 现在在其 API 中提供的内容,不需要使用外部类。
我还了解您可以使用此本机代码自定义此滑动所产生的操作:
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let more = UITableViewRowAction(style: .Normal, title: "More") { action, index in
print("more button tapped")
}
Run Code Online (Sandbox Code Playgroud)
是否有任何现代本机代码可以在 UITableViewCell 上定义“右滑动”?
我刚刚开始使用Geb,并且在从Book of Geb输入示例代码时遇到此错误:
import geb.Browser
Browser.drive {
go "http://google.com/ncr"
// make sure we actually got to the page
assert title == "Google"
// enter wikipedia into the search field
$("input", name: "q").value("wikipedia")
// wait for the change to results page to happen
// (google updates the page dynamically without a new request)
waitFor { title.endsWith("Google Search") }
// is the first link to wikipedia?
def firstLink = $("li.g", 0).find("a.l")
assert firstLink.text() == "Wikipedia"
// click the link
firstLink.click()
// wait …Run Code Online (Sandbox Code Playgroud)