我希望在这里问这不是太基本,但我(再次)被卡住了。
我有一个数组(从 sqlite db 填充)并希望将这些数据插入 UITableView。
所以基本上我希望我的文本字段和按钮,当然还有我的表格视图都驻留在同一个窗口中。我发现的大多数示例都是关于对 tableview 进行硬编码并填充到 viewDidLoad 中,我不想这样做,因此不能使用这些示例(或者更确切地说,它们不起作用)
这就是我得到的:
if (sqlite3_prepare_v2(dbHandle, query, -1, &statement, NULL) == SQLITE_OK ){
NSMutableArray *array = [[NSMutableArray alloc] init];
//step through the results
while (sqlite3_step(statement) == SQLITE_ROW) {
[array addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]];
//NSLog(@"Data: %@",[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]);
}
dataArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[array release];
sqlite3_finalize(statement); //releases the resources associted with the statment
sqlite3_close(dbHandle); //close db
//***********here I want something like: "tableview.data = dataArray.data"*******
有没有人有任何例子可以指出或写在这里?