2012-08-30 47 views
0

我有一个非常简单的tableview在xib文件中,它的委托和数据源连接到TestVC。 TestVC很简单:UITableView不取消选择?

#import "TestVC.h" 

@implementation TestVC 

- (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *IDEN = @"IDEN"; 
    UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:IDEN]; 
    if (!cell) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:IDEN]; 
    } 

    cell.textLabel.text = @"test"; 
    return cell; 

} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return 10; 

} 

- (void)tableView:(UITableView *)_tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 
    NSLog(@"called"); 
    [_tableView deselectRowAtIndexPath:indexPath animated:YES]; 
} 

@end 

当我点击一个单元格时,它不会被取消选择。我甚至在那里写了一条日志语句来查看是否正在调用didDeselectRowAtIndexPath方法。

我在做什么错了?

+0

它不应该是'didSelectRowAtIndexPath方法之一:' ? – 2012-08-30 23:04:46

回答

1

您使用了错误的方法 - (空)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath

是你需要