objective c - Seeking advice for iPhone app structure -
I have been working with creating an iPhone app that will tap into a series of Twitter from the REST API JSON feed.
I am somewhat new to the development of iPhones, but I have made some apps in the past, although none of them need to tap into the API data.
So we say that we have 3 ideas in the interface Builder, which is being controlled by a controller:
- Feed
- Followers
- The following
Each of these ideas needs to display a JSON feed in a table view. The data should be loaded at the time of the display.
There will also be a search box that requests the Twitter Search API JSN feed and returns results in a UITWview in another view.
I have installed and imported the Jason-Interface Library in my project. I have also successfully received the feed in NSSTING
But here's my question:
-
How do I present my application to request for many JSON feeds and separate on different views - Display related data in different tables? All the tutorials I see show a JSON request formatted in a table on only one view. For example:
-
How does the interface builder fit into this? How can I use tables in my ideas in the interface builder?
The suggestion I am giving below is slightly higher than your situation. Whether or not it may be more, but always is a good idea to separate data and networking from user interface classes.
You should make a model layer, in other words, a group of sections which are responsible for getting data from the server and making it accessible to the rest of the application. The way to design a model layer is like designing a database: think of the data domain and what is the most convenient way of mapping (in this case your model classes will change the result of the Twitter data model.) It is also important that the interface Do not think much about it as it would look like. The model layer should be as per the UI as possible, so that changing the UI does not require a change in model sections.
Create a base model object, which you can sub-class to represent specific types of data. This base model should know how to call the server, and it should show a state in it, if the data is loading, completed or the loading has been canceled. For example, each table view cell can have a reference to a model object, and when the state of the model "loads", the cell will get some strings and other data from the model and will be updated in its form.
Keep in mind that there should not be many network requests at the same time. Instead, use a queue you should definitely use the great library for networking and queue. To work with a model layer as the outline, you also need to understand.
For your second question, this is very common. You can send your controller to dataSource
and delegate
and UITableViewDelegate
and UITableViewDataSource
implement the protocols using tables.
Comments
Post a Comment