0

我有一个问题,我使用自定义单元格UITableView,当我点击超过一根手指(2 根手指或更多)时,每个单元格上tableview的一些问题labels(显示信息)丢失了文本(它是空的)。所以我尝试在我的桌子上禁用多点触控,但它不受影响。我尝试添加tableView.allowsMultipleSelection = NO;tableView.multipleTouchEnabled = NO;进入cellForRowAtIndexPath or didSelectRowAtIndexPath. 但没有任何工作。请帮我找出解决方案。

谢谢!这是我的代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    int row = indexPath.row;

@synchronized (self) {
    if (row == [voicemailItems count]) {
        // User selected the blank rows
        [tableView deselectRowAtIndexPath:indexPath animated:YES];

        // Blank out the play button on previous selected row
        [self deselect];

        return;
    }
}

if (selectedRowIndexPath != nil) {
    if (row == selectedRowIndexPath.row) {
        // Selecting the same row twice will play the voicemail
        if (streaming == NO) {
            if (calling == NO) {
                // Play the voicemail
                [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(playVoicemailAction:) userInfo:indexPath repeats:NO];
            }

            return;
        }
        else {
            // Streaming VM
            if ([self isCallInProgress] == YES) {
                [ScreenUtils errorAllert:@"Cannot play voicemail while call is in progress." type:kUINotice delegate:self];
            }
            else {
                if (![self isVoicemailNotification:selectedRowIndexPath.row]) {
                    // Stream the voicemail
                    [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(playVoicemailAction:) userInfo:indexPath repeats:NO];
                }
            }
        }
    }
    else {
        // Selecting a different row
        [self shutdownPlayer];
        [self cancel];

        // Blank out the play button on previous selected row
        [self deselect];
    }
}

selectedRowIndexPath = indexPath;

// Enable Call Back button 
// Don't enable if private, etc.
btnCallBack.enabled = ([self canCallBack:row] &&
                       !calling &&
                       ([self isCallInProgress] == NO) &&
                       ![self isVoicemailNotification:selectedRowIndexPath.row]);

// Enable and Delete button
btnDelete.enabled = YES;

// Select the cell
VoicemailCell * cell = (VoicemailCell*)[tblView cellForRowAtIndexPath:indexPath];
[cell select:YES playing:[self isPlaying] stream:streaming];
[tblView setNeedsDisplay];

//[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
4

3 回答 3

3

试试这个,它对我有帮助!

cell.contentView.exclusiveTouch = YES;
cell.exclusiveTouch = YES;
于 2014-11-07T10:25:47.377 回答
1

@尝试这个

[cell setExclusiveTouch:YES]
于 2013-09-16T10:55:25.227 回答
1

经过多次尝试,我发现我需要在 didSelectRowAtIndexPath 的末尾添加以下代码:

[tableView deselectRowAtIndexPath:indexPath animated:YES];
于 2013-09-17T08:41:54.543 回答