2010-02-27 48 views
0

我創建了一個應該顯示來自外部(網絡)源的一些信息的TTViewController。 我已經與一些TTableViewControllers我曾經的TTModel系統(我創建了一個TTURLRequestModel和我TTTableViewControllers一個TTListDataSource)three20 - 爲TTViewController加載外部數據

工作什麼用TTViewController做到這一點的呢? 是否還有類似於DataSource和Request Model的內容,或者是否必須爲ViewController分配TTURLRequestDelegate並運行簡單的URL請求?

即時通訊問,因爲我不知道什麼是「最好」和「最新」的方式來填充我的viewcontroller從網絡數據。我知道如何做到這一點,而不是意見。

在此先感謝

編輯:一些代碼

我singlePostViewController:

@interface singlePostViewController : TTModelViewController 
     singlePostModel *_singlepostmodel; 
@end 
- (void) createModel { 
     _singlepostmodel = [[singlePostModel alloc] init]; 
} 

和我singlePostModel

@interface singlePostModel : TTURLRequestModel { 
} 

@end 

,但現在該怎麼辦?在哪裏加載我的東西,並設置它?

回答

3

查看TTModelViewController班。你會想要子類。您可以在createModel:方法中創建TTURLRequestModel,並將「self」添加到模型代表的列表中。有很多有趣的方法可以滿足你想要做的事情。

特別是,this PDF顯示了模型,數據源和控制器類之間的良好關係。

+0

嗯你有沒有像這樣的例子,或教程? – choise 2010-02-27 23:09:06

+0

添加了有用PDF的鏈接。 – brantonb 2010-03-02 16:51:02