开发者

Need to sort and group tableviews using SQLite on iPhone

I have two different tableviews, one needs to be grouped by regio开发者_StackOverflow中文版n, one needs to be listed alphabetically. I am using an SQLite database. The grouped tableview needs to be grouped by a column in the database called Region. The alphabetic view uses a column of data called hotSpgsName. Someone told me to use a NSDictionary, but I would like to know if I can access my SQLite directly. I am fairly new to programming, so any help would be much appreciated.

Thanks Jaime


I've figured out how to sort my tableView, so I wanted to add this answer in case anyone else is interested. In my AppDelegate, I have created a NSMutableArray where I open my SQLite database using a select statement:

const char *sqlStatement = "select * from horses";

All I did was add order by horseName asc

and my table view is now sorted in ascending order. Hope this helps someone else out there too.

Jaime

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜