【发布时间】:2014-08-21 22:09:02
【问题描述】:
我需要获取位于我的CustomCellS 类中的组件(开关、检查..)的indexPath.row。我正在自定义单元格类中尝试以下代码,但出现错误:
class CustomCellS: UITableViewCell{
@IBOutlet weak var switch: UISwitch!
var cell: UITableViewCell = switch.superview as UITableViewCell //crash
var tableView: UITableView = cell.superview as UITableView
var indexPath: NSIndexPath = tableView.indexPathForCell(cell)
...
}
错误:线程 1:EXC_Breakpoint(code=EXC_i386_BPT, subcode=0x0)
如何获取这个组件的indexPath.row? 谢谢!
【问题讨论】:
标签: ios swift xcode6 custom-cell