A very simple walkthrough of table loading and display is described above. Some friends may say, this also said is simple, can be a bit complicated?
Don't worry, as a programmer, keep in mind that no matter how complex applications evolve from simple applications.
Objective of this article
This article is based on the above, the application is extended to introduce the following content:
1. Data structure definition;
2. Loading and displaying data from plist files;
3. Display the Avatar in the table and adjust the table style;
4. Use the data model.
I. Data structure definition
In the previous walkthrough, an array was defined with Nsarray to provide tabular content, but in practice this functionality is far from satisfying the actual usage requirements.
In the previous article, we mentioned that we would like to do a maintenance of "Weibo concern people" application. So for the attention of people, a name clearly does not meet the needs of our application.
Before we begin, we might as well take a moment to determine what information we are interested in, in addition to our name, to determine the data structure. See figure below:
We add five attributes to our focus: Name, avatar, url, preference, and category.
Here we add a plist file to record the data we need to use later.
1. Click the right mouse button in "My Focus", select "New Group" in the pop-up menu, and enter "Data" as the name of the new group, as shown in the following figure:
2. Click the right mouse button on "Data", select "New File ...", then select "Resource" "Property List" and click "Next" to see the following image: