开发者

FMDB and UITableView

We have a database of many many rows in s开发者_StackOverflow社区qlite3. We are utilizing the FMDB Wrapper for SQLite3 to show data in a UITableView. It is preferred that we do not use Pagination as this doent feel very normal for an iPhone/iPad application. We were hoping that if we MUST do so we could do so in the form of 400 or so records.

What is the best way to do this? Is there any way to call the database on

-(UITableViewCell *)tableView:(UITableView *)tableView 
        cellForRowAtIndexPath:(NSIndexPath *)indexPath`

?

Even if we do a "More Records…" table cell, what will happen once they reach a huge number? Will we have to do 2-way pagination?

What is the best way to handle this?

Thanks.


Here's what I do, with a similar setup that has thousands of rows for the UITableView.

I have an array (actually a C++ stl vector) where each item in the array maps to a row in the UITableView. The array populated with the sqlite record ID's for the items I want to display. The memory taken by the array is 4 bytes per row.

cellForRowAtIndexPath looks up the record ID in the array, then queries from sqlite the fields I need for the cell. It's plenty fast since SQLite indexes the record ID column.

Mine is actually a bit more complicated since I have TableView sections, as well as a TableView index. But not overly more complicated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜