Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What I'm suggesting below may or may not be a bit more than what your situation requires, but it's <em>always</em> a good idea to separate the data and networking from you user interface classes.</p> <p>You should create a model layer, in other words a set of classes that are only responsible for getting data from the server and making it accessible to the rest of the app. The way to design a model layer is similar to designing a database: think about the data domain and what the most convenient way of mapping it is. (In this case your model classes will follow the twitter data model rather closely.) It is also important not to think too much about what the interface will look like. The model layer should be as independent of the UI as possible, so that changing the UI will not require changes to the model classes.</p> <p>Create a base model object that you can then subclass to represent specific kinds of data. This base model should know how to make a call to the server, and it should have a state showing if the data is loading, completed, or if the loading has been canceled. UI classes such as views and controllers can observe this state and update themselves when it changes.</p> <p>For example, each table view cell might have a reference to a model object, and when the model's state changes to "loaded", the cell will get some strings and other data from the model and update its appearance.</p> <p>Take care not to have too many network requests going at the same time. Instead, use a queue. You should definitely use the fantastic <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow noreferrer">ASIHTTPRequest</a> library for networking and queuing. To work with a model layer as outlined, you also need to understand <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html" rel="nofollow noreferrer">Key-Value Observing</a>.</p> <p>As for your second question, it's very general. You use the tables by making your controller the <code>dataSource</code> and <code>delegate</code> and implementing the <code>UITableViewDelegate</code> and <code>UITableViewDataSource</code> protocols.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload