views:

296

answers:

1

Hi,

This is the code of my initializer:

if (self = [super init]) {
    self.title = @"Posts";
    self.variableHeightRows = YES;
    //XLog("");

    PostsDataSource *dataSource = [[[PostsDataSource alloc] init] autorelease];
    [dataSource.delegates addObject:self];
    [dataSource load:TTURLRequestCachePolicyMemory nextPage:NO];

    self.dataSource = dataSource;
}
return self;

In my datasource I'm doing a TTURLRequest and when requestDidFinishLoad gets called, my datasource gets filled with some items.

This all works quite good, but my TTableViewController doesn't show any of these files because it gets initialised and displayed before my datasource is finished. I know it works, because caching my datasource to disk shows all items.

The question is: How do I tell my TTableViewController to refresh the data out of my datasource file in my "requestDidFinishLoad" ?

+1  A: 

Is your datasource bound to a TTURLRequestModel? If so, you may be missing a call to:

[super requestDidFinishLoad:request];

If it's bound to a base TTModel, you may be missing a call to:

[self didFinishLoad];

These should happen in your requestDidFinishLoad: method.

Update Didn't realize you weren't using a TTModel. Does your requestDidFinishLoad call:

[self dataSourceDidFinishLoad];

Update again based on comments below The documentation or tutorial you were reading is way out of date and newer version of Three20 no longer work this way. There is a great tutorial at http://three20.info/tutorials/github which should get you back on the right track.

chrissr
both methods throw an error. my interface for my dataSource: @interface PostsDataSource : TTListDataSource<TTURLRequestDelegate>
choise
Updated with additional code.
chrissr
i had that dataRouceDidFinishLoad a few hours ago. my app crashes in my requestDidFinishLoad method. XCode says_ warning: postdatasource my not respond to "-datasourcedidfinsihload"
choise
FYI, you're using what looks like a pretty old version of the Three20 framework. If this is a relatively young project, you may want to get the latest version and update your code to conform to the new Model/Datasource/Controller way of doing things.
chrissr
i am using the latest version from github :( do you have an example how to handle this a better way?
choise
Or based on your most recent comment, you may have the latest version of the framework, but be looking at old documentation.
chrissr
If you're using the latest version of Three20 from github, then the way you've coded your DataSource is out of date. There's a really nice tutorial on how to do it the "new" way here: http://three20.info/tutorials/github
chrissr
thanks, ill try this tomorrow :) (0 o'clock here)
choise
im currently trying this out, found something, check: http://three20.info/tutorials/github/page/2 .. is this tutorial up to date?
choise
Yep. That's the way I'm doing it with the latest Three20 and it works like a dream.
chrissr