2010-08-27 108 views
0

当我在桌面视图中选择一个项目时,我的应用程序响应时遇到问题。我正在运行我的应用程序委托(类似于dataSource和TitleForHeaderAtSection等的表函数)的所有内容,这些都被称为罚款。但是,当我点击列表中的项目时,它不会调用我的选择方法。我甚至把NSLog看到以防万一。Objective-C TableView选择项目故障

这里是我的代码:(其相当长的和广泛的,我知道那里有在那里废话并不需要在那里,但我只是在情况下,你需要它把所有的它...)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

{ 
NSLog(@"Selected Row.", @""); 
//Get the selected country 
[tableView deselectRowAtIndexPath:indexPath animated:NO]; 
NSDictionary *dictionary = [data objectAtIndex:indexPath.section]; 
//NSArray *array = [dictionary objectForKey:@"My Wishlists"]; 
//NSString *selectedWishlist = [array objectAtIndex:indexPath.row]; 

//Initialize the detail view controller and display it. 
WishlistDetailView *dvController = [[WishlistDetailView alloc] initWithNibName:@"WishlistDetailView" bundle:[NSBundle mainBundle]]; 
dvController.selectedWishlistId = [wishlistids objectAtIndex:indexPath.row]; 
NSLog(@"Selected row with wishlist id: %@", dvController.selectedWishlistId); 
[[self navController] pushViewController:dvController animated:YES]; 
[dvController release]; 
dvController = nil; 
} 

代码编译没有错误。

感谢您的持久帮助!

基督教斯图尔特

(由两者的选择允许复选框在界面生成器检查的方式。)

回答

0

tableView:didSelectRowAtIndexPath:UITableViewDelegate方法。你控制表视图的代表吗?

+0

哇我不小心忘了设置表视图的代表。非常感谢! – 2010-08-27 20:54:50