TTModel,TTTableViewController,TTListDataSource and SearchDisplayController in three20

it takes me many time in this:

 

when i use TTListDataSource for TTTableViewController ,i update the TTListDataSource and the TTTableViewController can't reload data,

 

as that,you may use TTModel for dataSource(demo in three20,TTCatalog project)

 

but the point is when you update reflesh the TTModel subclass you may do this:

 

[your_delegates perform:@selector(modelDidFinishLoad:) withObject:youTTModelObject]; 

 

 

if not,TTListDataSource or other will not call the method:-(void)tableViewDidLoadModel:(UITableView *)tableView; 

than  can't display  search text and all way show you :"No Result"

 

==========other==========

in TTModel,you must overrite the metho following this:

- (BOOL)isOutdated {
    return NO;
}

- (BOOL)isLoaded {
    return !!self.datas;
}


- (BOOL)isLoading {
    return NO;
}

- (BOOL)isEmpty {
    return !self.datas.count;
}


- (NSMutableArray*)delegates {
    if (!_delegates) {
        _delegates = TTCreateNonRetainingArray();
    }
    return _delegates;

} 

 

 here is the source code:https://github.com/snowleung/T20SearchBarDemo

posted @ 2012-06-30 01:54  snowlueng  阅读(225)  评论(0编辑  收藏  举报