gpt4 book ai didi

ios - 细节附件触摸时未调用accessoryButtonTappedForRowWithIndexPath

转载 作者:行者123 更新时间:2023-11-30 13:43:45 30 4
gpt4 key购买 nike

我有一个带有 UITableViewCellAccessoryType.DetailDisclosureButtonUITableView,但在点击详细信息图标时无法让它调用 accessoryButtonTappedForRowWithIndexPath。我的父 View 继承自 UITableViewDelegateUITableViewDataSource 并链接到IB中表的委托(delegate)和数据源。这是我的 cellForRowAtIndexPath

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let cell:UITableViewCell = self.resultsView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
if self.tableItems.count == 0 {
cell.textLabel?.text = "No Results Found."
} else {
//cell.accessoryView =
cell.accessoryType = UITableViewCellAccessoryType.DetailDisclosureButton
cell.textLabel?.text = self.tableItems[indexPath.row]
}

return cell
}

和我的accessoryButtonTappedForRowWithIndexPath

func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {        
let alert = UIAlertView()
alert.title = "Failure"
alert.message = "YUP"
alert.addButtonWithTitle("accessoryButtonTappedForRowWithIndexPath called")
alert.show()

self.performSegueWithIdentifier("locationDetailSegue", sender : self)
}

表格显示 (i) 图标很好,但是当我单击它时,没有任何内容被触发。我设置了一个带有要推送的segue 的 View ,但它甚至似乎没有调用该方法,因为我什至没有收到警报框。 sample table row

最佳答案

我相信它可以按照指定的方式工作,因为 Apple documentation说:

DisclosureIndicator

The cell has an accessory control shaped like a chevron. This control indicates that tapping the cell triggers a push action. The control does not track touches.

关于ios - 细节附件触摸时未调用accessoryButtonTappedForRowWithIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35229668/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com