내 테이블 뷰의 첫 번째 셀을 누르면 didSelectRowAtIndexPath
이 트리거되지 않습니다. 아무도 보이지 않거나 왜 이런 일이 발생했는지에 대한 단서가 있습니까? 내 테이블의 다른 모든 셀을 잘 작동하고 내 코드에서 중단 점을 넣을 didSelectRowAtIndexPath
첫 번째 셀을 두드리는 경우 응용 프로그램이 해당 코드로 이동하지 않지만 다른 셀이 두드린 경우 코드로 이동합니다.내 tableview의 첫 번째 셀을 누르면 didSelectRowAtIndexPath가 트리거되지 않습니다.
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger row = 0;
return row;
}
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger row = [indexPath row];
if (row == 0)
return nil;
return indexPath;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSUInteger row = [indexPath row];
//NSString *rowValue = [poolListData objectAtIndex:row];
int newRow = [indexPath row];
int oldRow = [lastIndexPathForPoolList row];
if (newRow != oldRow)
{
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
UITableViewCell *oldCell = [tableView cellForRowAtIndexPath: lastIndexPathForPoolList];
oldCell.accessoryType = UITableViewCellAccessoryNone;
lastIndexPathForPoolList = indexPath;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (NSInteger)tableViewForDelete:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [poolListData count];
}
- (UITableViewCell *)tableViewtableViewForDelete:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *DeleteMeCellIdentifier = @"DeleteMeCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DeleteMeCellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:DeleteMeCellIdentifier] autorelease];
}
NSInteger row = [indexPath row];
cell.text = [self.poolListData objectAtIndex:row];
return cell;
}
#pragma mark -
#pragma mark Table View Delegate Methods
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
[self.poolListData removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
이 시간 내 주셔서 감사하고 도움이 당신이 내게 줄 수 : 여기에 몇 가지 코드입니다!
엉망으로 미안합니다 ... 코드를 붙여 넣을 수없는 것 같습니다. – Jeff
수정되었습니다. 풀리스트 초기화를위한 lastindexpath는 어디에 있습니까? – ennuikiller
당신은 tableview.delegate를 설치 했습니까? – CiNN