Storyboard Segue From View Controller to Itself

2019-01-16 10:37发布

I am trying to make a mechanism to drill down a file / folder list. The idea is to show the same file list view controller every time the user selects a folder, and show a file detail view controller if he/she selects a file.

So far, I have created a segue from the file list view controller to the file detail view controller, and a segue from the file list table view cell to the the file list table view controller:

enter image description here

The issue with this is that as soon as the user taps the cell, the segue is executed. I would like to remove the segue from the table view cell and make one from the file list view controller to itself. That way, I could trigger the right segue programmatically when the user tapped the cell.

So, my question is: Is it possible to create a segue from a view controller to itself in Interface Builder?

9条回答
唯我独甜
2楼-- · 2019-01-16 11:35

I developed a method to create a segue using a phantom button. I believe it will solve your problem. You can read about it in my answer here.

查看更多
仙女界的扛把子
3楼-- · 2019-01-16 11:35

Hope this helps.

I found that you can create multiple prototype cells.

Than you can link every cell (in the Storyboard) to a different View.

Something like this:

NSString *CellIdentifier = @"Cell"; 
if (Condition2 ){
CellIdentifier = @"Cell2"; } 
if (Condition3 ){
CellIdentifier = @"Cell3"; }
查看更多
一纸荒年 Trace。
4楼-- · 2019-01-16 11:36

The correct answer is to use a Storyboard Reference that is referencing the UIViewController you want to segue to itself and then point the segue at it.

enter image description here

查看更多
登录 后发表回答