当我点击我的表格视图中的第一个单元格时didSelectRowAtIndexPath
没有触发......有没有人看起来和/或对为什么会发生这种情况有任何线索?我表中的所有其他单元格都可以正常工作,如果点击第一个单元格,我在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];
}
感谢您的宝贵时间和您能给我的任何帮助!