Create different segues from one tableView

喜欢而已 提交于 2019-12-12 05:04:16

问题


I created a menu inside of my app.

The menu has 4 cells, which are created by modifying a prototype cell.

Each of those cells should perform a segue to one of 4 ViewControllers.

How can I realize this? Any ideas?


回答1:


You can either:

1) Create 4 prototype cells having each one wired directly to its respective viewController. In this case, each give each prototype cell its own identifier (for example "cell1", "cell2", "cell3" and "cell4") and then in cellForRowAtIndexPath dequeue using the appropriate identifier for the row: ["cell1", "cell2", "cell3", "cell4"][indexPath.row].

OR

2) Wire the segues from the viewController icon at the top of your viewController, give the segues identifiers, and trigger the appropriate segue with performSegueWithIdentifier in didSelectRowAtIndexPath.



来源:https://stackoverflow.com/questions/34155608/create-different-segues-from-one-tableview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!