0
테이블보기가 있고 그 안에 셀에 UILongPressGestureRecognizer가 추가되었습니다. 문제는 터치 한 셀이 강조 표시되면 강조 표시되지만 일단 긴 제스처가 시작되면 (버튼을 누른 채로) 강조 표시가 사라집니다. 제스처는 작동하지만 여전히 잡혀 있지만 사용자에게 조금 혼란 스럽습니다. 보류 상태에서 셀을 강조 상태로 유지하려면 어떻게합니까?셀에서 holdgesture가있는 tablview가 강조 표시되지 않음
일부 코드 :이 문제를 잘 그러나 지금 홀드 다음 셀로 요구를 클릭 취소되면 - (void)handleLongPress:(UILongPressGestureRecognizer*)sender
후
//highlight the apprioriate cell
[self.myTableView selectRowAtIndexPath:indexPath animated:FALSE scrollPosition:UITableViewScrollPositionNone];
를 사용하여 고정 되었나요
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
//add long press gesture for the audio AB (eventually VC and TP as well) list
//so that users can hold the cell and after 5 seconds have the dialpad for editing that entry
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleLongPress:)];
longPress.minimumPressDuration = 1;
[cell addGestureRecognizer:longPress];
}
cell.textLabel.text = [self.tableArray objectAtIndex:indexPath.row];
return cell;
}
- (void)handleLongPress:(UILongPressGestureRecognizer*)sender
{
//used to get indexPath of cell pressed
UITableViewCell *cell = (UITableViewCell *)[sender view];
//get the indexPath of cell pressed
NSIndexPath *indexPath = [self.myTableView indexPathForCell:cell];
//use the index press to figure out the proper join to hold
self.sharedJoinNumber = indexPath.row+286 ;
}
[cell setHighlighted : YES animated : YES];를 사용해 보시기 바랍니다. –