0
我想创建一些静态表格视图单元格来存储我的内容。我的设置出现在画面我的笔尖文件:如何显示静态自定义单元格
从本质上说,我只有一个静态的细胞,包含地图视图和标签。
下一页配置我的Xcode文件内容如下:
页眉:
@interface CarParkDetailViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
{
UITableViewCell *infoCell;
MKMapView *detailMapView;
UILabel *addressLabel;
}
@property (nonatomic, retain) IBOutlet UITableViewCell *infoCell;
@property (nonatomic, retain) IBOutlet MKMapView *detailMapView;
@property (nonatomic, retain) IBOutlet UILabel *addressLabel;
@end
实现:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 1;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return infoCell;
}
上面的代码不起作用。 (首先看起来不正确)。我收到以下错误
***
终止应用程序由于未捕获的异常“NSInternalInconsistencyException”,理由是:“UITableView的数据源必须的tableView返回细胞:的cellForRowAtIndexPath:”
谁能告诉我什么正确的方法是在显示我的infoCell
?
嗨克里希南,谢谢你的回应。如果我需要每个角色都是不同的设计呢?我可以使用这种方法吗?其实我试图按照文档http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html。在“静态行内容技术”部分下。但我必须在这里错过一些东西。任何建议表示赞赏!谢谢 – Zhen 2011-05-23 09:19:37
这是我第一次看到这种方法。我会看到它并回应。 – Krishnan 2011-05-23 09:32:18
我相信你必须错过控制器和XIb文件中的单元之间的IB连接。我开发了类似的应用程序并进行了测试我没有问题。你也可以尝试调试,看看infoCell的值是否为零或有一些值。 – Krishnan 2011-05-23 09:40:48