2011-09-20 103 views
0

当我在常规的tableView获得细胞的textLabel.text(在didSelectRowAtIndexPath方法的方法),我做(和它的作品!):从UISearchDisplayController中的单元格获取单元格的textLabel.text?

UITableViewCell *cell = (UITableViewCell *)[(UITableView *)self.view cellForRowAtIndexPath:indexPath]; 
NSLog(@"Cell's text: %@",cell.textLabel.text); 

当我点击一个单元格,这并不工作在我的UISearchDisplayController。当我在该方法中推入下一个视图控制器时,它将推动。但是我总是为cell.textLabel.text得到“null”。

我在做什么错?

非常感谢!

+0

any ??? ???请! –

回答

0

与iphonedevsdk.com的家伙的帮助下,我想通了,此代码:

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 
NSLog(@"Cell's text: %@",cell.textLabel.text); 

这是因为以前的代码做什么,是它从视图控制器访问的tableView,而不是UISearchDisplayController的tableView。这段代码可以访问两个tableViews。

:-)