Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (中文) » UltraLite - C 及 C++ 编程 » API 参考 » 教程:使用 C++ API 构建 iPhone 应用程序

 

第 4 课:显示数据库的数据:

缺省情况下,表视图的数据源就是其控制器。在此应用程序的情况下,RootViewController 当前是表视图的数据源。在本课中,您将在 DataAccess 类中实现 UITableViewDataSource 协议。这样,DataAccess 类将负责向表视图提供所需的数据。

要开始操作,将协议添加到 DataAccess 标头。

@interface DataAccess : NSObject <UITableViewDataSource> {
    ULConnection *                    connection;
}
 获取数据库中的名称数目
 创建表单元格
 将 DataAccess 对象设置为数据源