Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableViewCell事件中的UIButton不工作_Iphone_Uitableview_Uibutton - Fatal编程技术网

Iphone UITableViewCell事件中的UIButton不工作

Iphone UITableViewCell事件中的UIButton不工作,iphone,uitableview,uibutton,Iphone,Uitableview,Uibutton,我在网上到处都能看到这个问题,列出的解决方案都不适合我 我已将UIButton添加到IB中的UITableViewCell。我已将自定义UITableViewCell类指定给UITableViewCell。我的自定义UITableViewCell类有一个iAction,我正在连接到内部修补事件(我尝试了其他事件,但它们都不起作用),但从未调用iAction函数 UITableViewCell中没有其他内容,我已将UIButton直接添加到内容视图中。而且一切都启用了用户交互!就这么简单,我没有什

我在网上到处都能看到这个问题,列出的解决方案都不适合我

我已将UIButton添加到IB中的UITableViewCell。我已将自定义UITableViewCell类指定给UITableViewCell。我的自定义UITableViewCell类有一个iAction,我正在连接到内部修补事件(我尝试了其他事件,但它们都不起作用),但从未调用iAction函数

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;
}

您是否已将此代码放入表视图中。? tableView.delegate=self; dataSource=self

谢谢,
bharath

您是否已将此代码置于表格视图中。? tableView.delegate=self; dataSource=self

谢谢,
bharath

问题似乎与我过于频繁地更新表格单元格有关,因此这中断了与单元格本身的任何交互

问题似乎与我过于频繁地更新表格单元格有关,因此,这中断了与单元格本身的任何交互

您的
iAction
方法是在单元格子类中定义的还是在视图控制器中定义的?如何在表格视图中初始化单元格?我已经编辑了这个问题以包含您的问题!感谢您在单元格子类或视图控制器中定义的
iAction
方法?如何在表格视图中初始化单元格?我已经编辑了这个问题以包含您的问题!谢谢