在 Xcode 4 中创建表视图

发布于 2024-12-19 05:31:46 字数 263 浏览 3 评论 0原文

我是 Xcode 4 的新手,并且在使用 TableView 时遇到一些问题。 我有一个 ViewController,我将其拖入 TableView 中。 我有源模型,并创建了一个数组, 但我不知道如何让 TableView 显示值。

我不想使用 TableViewController,因为我希望表格比 iPhone 屏幕小 - 但如果没有它,我不知道如何将 TableView 连接到控制器。

有人可以为我提供一个很好的分步解释来说明如何做到这一点吗?

谢谢

I'm new to Xcode 4, and having some problems with TableView.
I have a ViewController which I dragged into a TableView.
I have the source model, and created an array,
but I don't know how to get the TableView to display the values.

I don't want to use a TableViewController, because I want the table to be smaller than the IPhone screen - but without it I don't know how to connect the TableView to a controller.

can someone provide me a good step-by-step explanation of how to do it?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

可是我不能没有你 2024-12-26 05:31:46

创建 TableView 的简单而高效的示例,此处

A simple and efficient example of creating a TableView , here

假面具 2024-12-26 05:31:46
  • 将视图控制器声明为符合 UITableView 委托和数据源协议
  • 将表视图的委托和数据源出口连接到界面生成器中的视图控制器,
  • 实现文档中描述的方法。

表视图控制器在编辑模式和表上的一些视觉功能方面为您提供了一些额外的功能,但是您可以将表视图添加到由标准视图控制器管理的视图中,就可以了。

  • declare your view controller as conforming to the UITableView delegate and datasource protocols
  • Connect the tableview's delegate and datasource outlets to your view controller in interface builder
  • implement the methods as described in the documentation.

Table view controllers give you a little extra in terms of editing mode and a few visual features on the table, but you can add a table view to a view managed by a standard view controller and be just fine.

骄傲 2024-12-26 05:31:46

如果我正确理解了问题以将较小的表连接到代码,则右键单击界面生成器中的表并将委托连接到文件所有者,它应该可以工作。

否则,如果您查看 http://www.geekylemon.com 他们有一些非常好的教程

干杯

If i understoof the question correctly to connect the smaller table to the code, you right click on the table in the interface builder and connect the delegate to the files owner it should work.

Otherwise if you check out http://www.geekylemon.com they have some really good tutorials

Cheers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文