2010-08-27 63 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