私は6つのセルを含むメニューを持っています。最初のセルにUIViewController
は2番目のセルが含まれていますUITableView
最初のセルをクリックすると新しいページが表示され、このボタンをクリックするとボタンが表示され、メニューから tableView を含む 2 番目のセルにアクセスしたい
// このコードを使用して、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];
クリックでテーブルビューから他のビューに移動したいというあなたの質問を理解している限り..したがって、これに似たコードを使用する必要があります..
-(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];
}
UIButton
Tapped Methodに次の coed を記述します。
-(void) ButtonTapped:(UIButton *) sender
{
NSIndexPath *indexpathNew = [self.tblView indexPathForCell:(UITableViewCell *)[sender superview]];
NSLog(@"%@",indexpathNew.row);
}
indexpathNew
indextPath
セルの選択ボタンの返却です。
私のコードを試してみてください。