2012-08-25 31 views
1
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{ 
[super tableView:tableView didSelectRowAtIndexPath:indexPath]; 
[tableView deselectRowAtIndexPath:indexPath animated:NO]; 
NSLog(@"selezione"); 
SitiViewController *sitoSelezionato = [[SitiViewController alloc] init]; 
sitoSelezionato.title = [[self.objects objectAtIndex:indexPath.row] objectForKey:@"Title"]; 
sitoSelezionato.url = [NSURL URLWithString:[[self.objects objectAtIndex:indexPath.row] objectForKey:@"URL"]]; 

[self.navigationController pushViewController:sitoSelezionato 
            animated:YES]; } 

我正在使用UITableViewController的子類,我需要單元格被按下並推動一個新的視圖控制器;我嘗試了我之前複製和粘貼的代碼,但有些東西不能正常工作......只有當我選擇另一行時,纔可以推送newViewcontroller ..例如,如果我單擊第一行,我可以推新視圖控制器,如果我點擊在第二行...我已經設置了委託和數據源...我無法處理這個問題..任何想法出來這個?didSelectRowAtIndexpath工作不正常

+0

這個問題對我來說是可以理解的,你能解釋一下更好的問題嗎? – aleroot

+0

得到了錯誤...我misstyped方法被調用一旦用戶單擊單元格... didSelectRowAtindexPath ...不didDeselectRowAtindexPath – luca

回答

2

您誤以爲didSelectRowAtIndexPathdidDeselectRowAtIndexPath