【问题标题】:UITableView problems [closed]UITableView 问题 [关闭]
【发布时间】:2010-01-10 17:59:41
【问题描述】:

我在 Interface Builder 的 ViewController 中添加了一个 UITableView 组件,以便更容易自定义,因为 UITableViewController 不允许我设置背景图像。

然后我实现了一些基本功能,只是为了测试它是否有效,但无法让它显示任何单元格 - 有人对如何让它工作有任何建议吗?

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section     {
    if (section == 1) {
        return 2;
    }
    else {
        return 1;
    }
}

我创建了一个名为 tripSettings 的 UITableView IBOutlet 并将其连接为参考插座

【问题讨论】:

    标签: iphone xcode uitableview interface-builder


    【解决方案1】:

    确保作为您的视图控制器的 tableView 为 dataSourcedelegate

    【讨论】:

      【解决方案2】:

      你必须让你的类从 UIViewController 继承,然后使用接口生成器将委托和数据源设置为文件的所有者

      【讨论】:

        【解决方案3】:

        对于 tableView,应用程序中的多个实体必须交互:视图控制器、表格视图本身以及表格视图的数据源和委托。

        【讨论】:

        • 从你的问题我猜你在委托和数据源映射方面有问题。
        猜你喜欢
        • 2012-10-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-30
        • 2011-02-03
        • 2012-05-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多