我正在嘗試使用storyboard/segue來處理UITableView與標準轉換以及細節泄露按鈕之間的轉換。看了就到這裏了幾個不同的崗位我已經建立了我的項目是這樣的:IndexPath for segue from accessoryButton
- 領帶的UITableViewCell和ViewController之間主要賽格瑞
- 領帶二次賽格瑞從父視圖控制器到新的ViewController
實現
accessoryButtonTappedForRowWithIndexPath
如下:-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"DetailSegue" sender:self]; }
這個偉大的工程,我的prepareForSegue: sender:
得到ç如預期一般。麻煩的是,我需要知道所選元素的indexPath。從UITableViewCell中的SEGUE檢索indexPath這樣的:
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
不幸的是,當我嘗試這樣做,已經叫accessoryButton,返回null
。
我一些基礎的代碼的關閉的原來的問題是在這裏:Detail Disclosure Button and Segues
是否有返回indexPath爲accessoryButtons了的tableView的方法?我需要以其他方式訪問indexPath嗎?
感謝亞當,這應該是公認的答案! – Pat 2013-06-30 19:14:24
當我這樣做時,發件人是我所在的TableViewController。 因此,在執行Segue時,我通過了單元格作爲發件人 – 2016-03-10 01:20:19
我們如何在Swift 3中執行此操作? – nyxee 2017-05-29 01:41:17