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をプッシュできます..たとえば、最初の行をクリックすると、新しいView Controllerをクリックするとプッシュできます2行目...私はすでにデリゲートとデータソースを設定しています...私はこの問題を処理できません..これから出てくるアイデアはありますか???

4

1 に答える 1

2

と間違えdidSelectRowAtIndexPathましたdidDeselectRowAtIndexPath

于 2012-08-25T10:46:08.910 に答える