【发布时间】:2015-07-25 20:15:04
【问题描述】:
在 UITableViewCell 的一个按钮内,我有这个功能,它可以自动滚动到下一个单元格。
var tableView = self.superview?.superview
let point = sender.convertPoint(CGPointZero, toView : tableView)
let indexPath = tableView.indexPathForRowAtPoint(point)!
if indexPath.row < tableView.numberOfRowsInSection(indexPath.section) {
let newIndexPath = NSIndexPath(forRow:indexPath.row + 1, inSection:indexPath.section)
tableView.scrollToRowAtIndexPath(
newIndexPath, atScrollPosition:.Top, animated: true)
}
我有一个错误:“让 indexPath = tableView.indexPathForRowAtPoint(point)!”说:“没有更多上下文,表达的类型是模棱两可的”
您知道如何解决它吗?我想将该代码保留在我的 UITableViewCell 中。
非常感谢
【问题讨论】:
标签: ios iphone swift uitableview uitableviewrowaction