在模拟器中运行应用程序后,xcode 中的原型单元不显示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9849766/
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
Prototype cells in xcode don't show after I run the app in simulator
提问by Nick th
I am a newbie in xcode developing. I try to create a table view with prototype cells. After I create the table view and add details in the cells , when I run the app in the simulator the information on the cells don't appear. Why? Please explain me in detail. Is there a step by step tutorial that can fix my problem?
我是 xcode 开发的新手。我尝试使用原型单元格创建表格视图。创建表格视图并在单元格中添加详细信息后,当我在模拟器中运行应用程序时,单元格上的信息不会出现。为什么?请给我详细解释。是否有分步教程可以解决我的问题?
回答by Jay Haase
I think this postwill answer your question. In short, you probably need to use a Table View Controller instead of a View Controller.
我想这篇文章会回答你的问题。简而言之,您可能需要使用表视图控制器而不是视图控制器。
You may also need to switch the Table View's content from Dynamic Prototypesto Static Cells.
您可能还需要将 Table View 的内容从Dynamic Prototypes切换到Static Cells。
回答by bereket
you probably forget to put Cell id: Make sure you have used similar Cell ID for your prototype cell in "Show Attribute inspector" and in your implementation in method "(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath"
您可能忘记放置 Cell id:确保您在“显示属性检查器”和方法中的实现中为原型单元使用了类似的 Cell ID(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath"
回答by JCutting8
I know its late, but anyone in 2017 still ripping their hair out trying to solve this problem, make sure you are using the correct "identifier" field in the Interface builder to provide your reusable identifier. Interface builder has an "accessibility identifier" and a "reusable identifier" both conveniently labelled in the interface builder as "identifier" which can easily be confused.
我知道为时已晚,但 2017 年的任何人仍在努力解决这个问题,请确保您在界面构建器中使用正确的“标识符”字段来提供您的可重用标识符。界面生成器有一个“可访问性标识符”和一个“可重用标识符”,两者在界面生成器中都方便地标记为“标识符”,这很容易混淆。