我有一个带有一个按钮和一个 uilabel 的自定义 TableViewCell。实际上 mi 在哪里处理这个下载事件以及如何处理?
这是我的自定义单元格。我试图这样处理但得到了错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [downloadPageCell downloadSong:]: unrecognized selector sent to instance 0x94b1490'
*** First throw call stack:
我的代码在这里
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
downloadPageCell *newCell = nil;
newCell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(newCell == nil)
{
NSLog(@"newCell ===================");
NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@"downloadPageCell" owner:self options:nil];
newCell = [ nibViews lastObject];
}
newCell.titleText.text=[URLTitle objectAtIndex:indexPath.row];
[newCell.downloadButton addTarget:self action:@selector(DOWNLOAD:) forControlEvents:UIControlStateNormal];
return newCell;
}
处理来自单元格的按钮事件的真正代码是什么?
编辑
-(void)downloadButtonPressed:(UIButton*)sender
{
NSLog(@"download button pressed");
}