0

在表格视图中选择项目时,我的应用无法响应。我正在运行我的应用程序委托中的所有内容(表函数,如 dataSource 和 TitleForHeaderAtSection 等),这些都被调用得很好。但是,当我点击列表中的项目时,它不会调用我的选择方法。我什至放了一个 NSLog 以防万一。

这是我的代码:(它很长而且很广泛,我知道那里有不需要的废话,但我把它全部放了以防万一你需要它......)

- (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;
}

代码编译没有错误。

感谢您一直以来的帮助!!

克里斯蒂安·斯图尔特

(顺便说一句,在界面生成器中选中了两个允许选择的复选框。)

4

1 回答 1

0

tableView:didSelectRowAtIndexPath:是一种UITableViewDelegate方法。您是表格视图的代表吗?

于 2010-08-27T20:53:07.367 回答