I new to Objective C. I have one table in SQLite, and in the table have one record:
("aaa","bbb","ccc")
I want to display thi开发者_开发知识库s record in one cell of the tableView. How can I do this?
Although I don't like to point people somewhere else than SO, go read here. You could start reading from the point where a sample cocoa touch app. is created and you have also some code, that helps you follow the steps.
As an alternative (again with source code) you can do also this other tutorial.
If you happen to like paper books I'd like to suggest this one. Chapter 26 contains exactly what you're are searching for (of course don't read the chapter alone if you're a beginner iOs developer). You can download the code for the book to explore that chapter, application: "Nayshunz".
For example, you have the following method for saving database in your app:
+(nsmutablearray*)getalldata
{
}
In your tableviewfile add that array to some array like:
newarray=[database getalldata];
and in the cell of table view just write the code:
cell.textlabel.text=[[newaaray objectatindex:indexpath.row]valueforkey@"abc"];
and you should be set.
It depends upon you how you are accessing the array using the keys of dictionary.
精彩评论