我在xib中创建了一个自定义单元格(在iOS6中使用Storyboards,但是为单元格创建了单独的xib),现在我试图将我的扬声器按钮连接到我的UITableViewController sublcass中的IBAction。在xib上的自定义单元格上设置IBAction?
我注册了我的手机在我viewDidLoad中:
[self.tableView registerNib:[UINib nibWithNibName:@"MissedWordTableCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MissedWordCell"];
我已经尝试了几种不同的方法来添加目标。例如,在我的tableView:cellForRowAtIndexPath中,我试图直接添加目标。
static NSString *CellIdentifier = @"MissedWordCell";
MissedQuestionEntity *missedQuestion;
// forIndexPath: is iOS6
MissedWordTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Add target here? Didn't work. @selector(playWordAction) or @selector(playWordAction:)
// [cell.playAudioBtn addTarget:self action:@selector(playWordAction) forControlEvents:UIControlEventTouchUpInside];
我也试图设置文件所有者,以我的表视图控制器在我的自定义单元格厦门国际银行,但仍然没有工作。
这里是我的错误信息:
2013-07-30 07:47:15.833 Spanish[69420:c07] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSArrayI doIt]: unrecognized selector sent to instance
0xec34430'
*** First throw call stack:
(0x231e012 0x172de7e 0x23a94bd 0x230dbbc 0x230d94e 0x1741705 0x6752c0 0x675258 0x736021 0x73657f 0x7356e8
0x6a4cef 0x6a4f02 0x682d4a 0x674698 0x1c0bdf9 0x1c0bad0 0x2293bf5 0x2293962 0x22c4bb6 0x22c3f44 0x22c3e1b
0x1c0a7e3 0x1c0a6
要调用'doIt'方法在某个地方在你的代码中,请检查 –
是的,那是我在自定义单元格xib中向文件所有者(我的UITableViewController的子类)所做的IBAction连接。 – h4labs
doIt IBAction playAudioBtn按钮?或者是其他东西? – DharaParekh