0
我有一个自定义的UITableViewDelegate内,如下面的我应该在哪里把动作的按钮的UITableViewDelegate
class CusinePreferencesTableView: NSObject, UITableViewDelegate, UITableViewDataSource {
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(CellIdentefiers.oneCusinePreferencesCell.rawValue, forIndexPath: indexPath) as! OneCusinePreferencesTableViewCell
//do bla bla bla with the cell
cell.leftButton.addTarget(self, action: "cusineClicked:", forControlEvents: .TouchDown)
cell.rightButton.addTarget(self, action: "cusineClicked:", forControlEvents: .TouchDown)
cell.setNeedsDisplay()
return cell
}
我的手机有两个按钮,正如你看到的,我设置为他们的行动。
我得到的例外规定,unrecognized selector sent to instance 0x7fa660ecbfa0
我试图把
func buttonClicked(sender: PreferenceButton){
// do bla bla bla
}
同时在CusinePreferencesTableView
,并具有用于UITableView的电源插座中的UIViewController内,并使用CusinePreferencesTableView作为其代表,但我保持与它的例外
请帮助
你的按钮动作有'cusineClicked:'名字,但是你用'buttonClicked'名称实现它,系统不会找到它,它会崩溃 – azimov
对不起........... .................. – sarah