简体   繁体   English

无法在Uitable View(ios7)上禁用多点触控

[英]Cannot disable multi touch on Uitable View (ios7)

I have an problem that i use custom cell for UITableView , when I tap more than one finger (2 fingers or more) on my tableview it had many problems some of my labels on each cells (to display information) lost texts (it's empty). 我有我使用自定义单元格为问题UITableView ,当我点击我的一个以上的手指(2个手指或以上) tableview它有很多问题,我的一些的labels上的每个细胞(显示信息)丢失文本(它是空的) 。 So that I try to disable multi touch on my table, but it's not affect. 因此,我尝试禁用对我的桌子的多点触控,但这并不影响。 I try to add tableView.allowsMultipleSelection = NO; 我尝试添加tableView.allowsMultipleSelection = NO; or tableView.multipleTouchEnabled = NO; tableView.multipleTouchEnabled = NO; into cellForRowAtIndexPath or didSelectRowAtIndexPath . cellForRowAtIndexPath or didSelectRowAtIndexPath But nothing work. 但是没有任何作用。 Please help me to find out solution. 请帮助我找出解决方案。

Thank you! 谢谢! Here is my code: 这是我的代码:

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

Try this, it helps me! 试试这个,对我有帮助!

cell.contentView.exclusiveTouch = YES;
cell.exclusiveTouch = YES;

@尝试这个

[cell setExclusiveTouch:YES]

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

[tableView deselectRowAtIndexPath:indexPath animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM