问题描述
当我在 tableview上点击多个手指(2个手指或更多个手指)时,我有一个问题,我使用自定义单元格
在每个单元格(显示信息)丢失的文本(它是空的)上,我的一些 UITableView
标签
有很多问题。所以我尝试在我的桌子上禁用多点触控,但这并没有影响。我尝试将 tableView.allowsMultipleSelection = NO;
或 tableView.multipleTouchEnabled = NO;
添加到 cellForRowAtIndexPath或didSelectRowAtIndexPath
。但没什么用。请帮我找出解决方案。
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];
}
推荐答案
经过多次尝试后,我发现我需要在didSelectRowAtIndexPath结束时添加以下代码:
after many tries, I find out that I need to add the follow code at the end of didSelectRowAtIndexPath:
[tableView deselectRowAtIndexPath:indexPath animated:YES];
这篇关于无法在Uitable View(ios7)上禁用多点触控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!