2010-02-27 47 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