2011-01-08 67 views
1

我在网上看到这个问题,并没有列出的解决方案为我工作!UIButton在UITableViewCell事件不起作用

我已将UIButton添加到IB中的UITableViewCell。我已经为UITableViewCell分配了一个自定义的UITableViewCell类。我的自定义UITableViewCell类有一个IBAction,它可以连接到Touch Up Inside事件(我尝试了其他事件,但它们都不起作用),但是IBAction函数从未被调用!

UITableViewCell中没有其他东西,我已经将UIButton直接添加到内容视图中。一切都启用了用户交互!这很简单,我没有任何复杂的事情发生!

什么是关于一个UITableViewCell停止按钮的工作?

编辑:根据要求,我初始化我UITableViewCells代码自定义类被称为DownloadCell

- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"DownloadCell"; 

    DownloadCell *cell = (DownloadCell *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     UIViewController * cellController = [[UIViewController alloc] initWithNibName:@"DownloadCell" bundle:nil]; 
     cell = (DownloadCell *)cellController.view; 
     [cellController release]; 
    } 

    SoundLibrarianIPhoneAppDelegate * del = (SoundLibrarianIPhoneAppDelegate *)[UIApplication sharedApplication].delegate; 

    DownloadQueue * dq = del.downloadQueue; 

    DownloadJob * job = [dq getDownloadJob: indexPath.row]; 
    [job setDelegate:self]; 

    SoundInfo * info = [job sound]; 

    NSArray * seperated = [info.fileName componentsSeparatedByString: @"."]; 
    NSString * displayName = [seperated objectAtIndex:0]; 
    displayName = [displayName stringByReplacingOccurrencesOfString:@"_" withString:@" "]; 
    displayName = [displayName capitalizedString]; 

    [cell.titleLabel setText: displayName]; 
    cell.progressBar.progress = job.percentCompleted; 
    [cell.progressLabel setText: [job getProgessText]]; 

    cell.selectionStyle = UITableViewCellSelectionStyleNone; 
    cell.userInteractionEnabled = YES; 

    [cell setDelegate:self]; 

    return cell; 
} 
+0

是您的小区内定义了`IBAction`方法子类还是在你的视图控制器?你如何初始化你的表格视图中的单元格? – BoltClock 2011-01-08 18:29:24

回答

1

看来问题是我怎么办更新表细胞过于频繁,所以这是中断与细胞本身的任何交互

0

具有u放在这个代码INT表视图? tableView.delegate = self; tableView.dataSource = self;

感谢, 巴拉斯