lee
lee

Reputation: 8115

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). So that I try to disable multi touch on my table, but it's not affect. I try to add tableView.allowsMultipleSelection = NO; or tableView.multipleTouchEnabled = NO; into 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];
}

Upvotes: 0

Views: 3860

Answers (3)

Nubaslon
Nubaslon

Reputation: 751

Try this, it helps me!

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

Upvotes: 3

lee
lee

Reputation: 8115

after many tries, I find out that I need to add the follow code at the end of didSelectRowAtIndexPath:

[tableView deselectRowAtIndexPath:indexPath animated:YES];

Upvotes: 1

abhishekkharwar
abhishekkharwar

Reputation: 3529

@try this

[cell setExclusiveTouch:YES]

Upvotes: 1

Related Questions