У меня есть проблема с тем, что я использую пользовательскую ячейку для UITableView
, когда я нажимаю более одного пальца (2 пальца или больше) на моем tableview
, у него было много проблем, некоторые из моих labels
на каждая ячейка (для отображения информации) потеряла тексты (она пуста). Так что я пытаюсь отключить multi touch на моем столе, но это не влияет. Я пытаюсь добавить tableView.allowsMultipleSelection = NO;
или tableView.multipleTouchEnabled = NO;
в cellForRowAtIndexPath or didSelectRowAtIndexPath
. Но ничего не получается. Пожалуйста, помогите мне найти решение.Невозможно отключить многократное касание на Uitable View (ios7)
Спасибо! Вот мой код:
- (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];
}
Можете ли вы показать код. – Fogmeister
вы должны работать над причиной - не симптомы. – vikingosegundo
Почему вы вызываете методы, которые влияют на tableView из методов делегата? Они должны вызываться при распределении/инициализации tableview и только один раз. – trojanfoe