2

I'm trying to create a simple form using a UITableViewController as documented in the Apple Developer Documentation here.

What I'm trying to do is located in the section entitled: "The Technique for Static Row Content"

I've created a couple of UITableViewCells and added them to my nib, but when I try and access them to add them to the UITableView (in the cellForRowAtIndexPath: method) they are always null.

It's like they are not being properly loaded from the nib. I've double/triple/quadruple checked my code to make sure I'm doing it exactly as detailed in the docs, but no luck.

Is there something obvious I'm missing here?

4

2 回答 2

0

您是否确定已在 nib 文件中连接了 IBOutlets?

在您的 ViewController.h 文件中,您应该有:

IBOutlet UITableViewCell *specialCell1;
IBOutlet UITableViewCell *specialCell2;

然后这些中的每一个都应该“连接”到 nib 文件中的相应单元格。如果没有,它们将不存在!

于 2010-04-20T16:14:13.587 回答
-1

弄清楚了...

当我添加我的父视图控制器时,我使用的是简单的“init”。切换到“initWithNibName”解决了这个问题......

还在学习... :)

于 2010-04-20T16:31:27.517 回答