Xcode Storyboard 是否应该支持带有“动态原型”单元格的 UITableView 转场?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7911588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:14:47  来源:igfitidea点击:

Should Xcode Storyboard support segues from a UITableView with 'dynamic prototype' cells?

iphoneiosxcodestoryboardxcode4.2

提问by Greg

I can't get this working. If I drop the master UITableView to use Static cells I can get the segues working, such that when you click on a row in the master it automatically pushes the Child controller on. But with 'dynamic prototype' cells, I click on one of the cells and nothing happens...

我不能让这个工作。如果我放下主 UITableView 以使用静态单元格,我可以使 segue 工作,这样当您单击主中的一行时,它会自动推动子控制器。但是对于“动态原型”单元格,我单击其中一个单元格,但没有任何反应......

Am I supposed to programmatically push the child controller within the prepareForSeguemethod or something? In which case I'm not sure what advantage a segue here would have over the old way of just using

我应该以编程方式在prepareForSegue方法中推送子控制器还是什么?在这种情况下,我不确定这里的 segue 比仅使用的旧方式有什么优势

回答by Jamie

No, you don't have to manually push the child controller. Did you connect a segue in your storyboard file from the dynamic cell to the child controller? Also did you give your dynamic cells an identifier? You can also check out this tutorial:

不,您不必手动推动子控制器。您是否将故事板文件中的转场从动态单元格连接到子控制器?你也给你的动态单元格一个标识符吗?您还可以查看本教程:

http://maniacdev.com/ios-5-sdk-tutorial-and-guide/xcode-4-storyboard/

http://maniacdev.com/ios-5-sdk-tutorial-and-guide/xcode-4-storyboard/

Scroll down to "Beginning iOS storyboards" and have a look at part 1 and part 2. I found them most helpful.

向下滚动到“开始 iOS 故事板”并查看第 1 部分和第 2 部分。我发现它们最有帮助。

回答by slapslap

Use prepareForSugue:instead, [table indexPathForSelectedRow prepareForSuguewill be called before the next scene's loadView.

prepareForSugue:改为使用,[table indexPathForSelectedRow prepareForSugue将在下一个场景的loadView.

回答by Sutra

Maybe you forgot to set the reuse identifier of Table View Cell.

可能你忘记设置Table View Cell的复用标识符了。