3

私は6つのセルを含むメニューを持っています。最初のセルにUIViewControllerは2番目のセルが含まれていますUITableView

最初のセルをクリックすると新しいページが表示され、このボタンをクリックするとボタンが表示され、メニューから tableView を含む 2 番目のセルにアクセスしたい

4

3 に答える 3

4

// このコードを使用して、TableviewCell を更新、削除、または挿入します

// reloading cell
NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0];
        [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationTop];

// inserting cell
NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0];
        [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationTop];

// deleting cell
 NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0];
        [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationBottom];
于 2013-03-19T10:37:00.070 に答える
3

クリックでテーブルビューから他のビューに移動したいというあなたの質問を理解している限り..したがって、これに似たコードを使用する必要があります..

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

    Detail *img1=[[Detail alloc]initWithNibName:@"Detail" bundle:Nil];
    img1.labelString = [titleArray objectAtIndex:indexPath.row];
    [self presentViewController:img1 animated:YES completion:nil];    
}
于 2013-03-19T10:29:44.543 に答える
1

UIButtonTapped Methodに次の coed を記述します。

-(void) ButtonTapped:(UIButton *) sender
{
        NSIndexPath *indexpathNew = [self.tblView indexPathForCell:(UITableViewCell *)[sender superview]];

      NSLog(@"%@",indexpathNew.row);
}

indexpathNewindextPathセルの選択ボタンの返却です。

私のコードを試してみてください。

于 2013-03-19T10:30:11.930 に答える