1. 首先需要做的是, 定义数据源. UITableView是需要一个数据源的, 我这用使用的是SQLITE数据库, 因此做了一个小小的分页查询. SQLIte的分页查询与MySQL的相同. [sql] view plain copy select * from table where 列名 = 条件 limit 页数 * 每页显示记录数, 每页显示记录数 [cpp] view plain copy +(NSMutableArray *)GetRecord:(NSInteger)p { //代码中, 除了SQLITE的SELECT操作之外, 和分页有关系的就是参数p和下面分页的SQL语法拼接形式了. NSString *query = [NSString stringWithFormat:@"select * from table order by ID limit %d,10", (p-1) * 10]; char *select =(char *)[query UTF8String]; NSMutableArray *array = [[NSMutableArray alloc] init]; sqlite3 *database; if(sqlite3_open([DbObject GetDatabasePath], &database) == SQLITE_OK) { sqlite3_stmt *statement; if(sqlite3_prepare_v2(database, select, -1, &statement, nil)== SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { //根据字段的类似, 使用sqlite3_column_init, sqlite3_column_blob, sqlite3_column_text等将数据从记录行中取出来. 此处代码略 //然后将出来的值,以键值对应的形式赋值给NSDictionary数组. NSDictionary *rowRecord = [[NSDictionary alloc] initWithObjectsAndKeys:nsID,@"ID"