Three20框架好久不用了,而且也已经过时了,不过它在当时来讲确认解决了许多麻烦,省确了许多代码,仅此环念。
最近用xcode4.2打开老项目后发现,不能编译,解决掉那些被警告的过时api后又发现 “Empty TTTableViewHeaders displaying although they shouldn't!”,因为苹果在ios5这后表格行为发生了变化。
不过最为有趣的是我使用xcode3.2编译到我的ios5真机中,显示是正确的,而用xcode4.2编译就会出现empty head.
tableView:heightForHeaderInSection:
Special Considerations
Prior to iOS 5.0, table views would automatically resize the heights of headers to 0 for sections where tableView:viewForHeaderInSection:
returned a nil
view. In iOS 5.0 and later, you must return the actual height for each section header in this method.
YourViewController ---------> TTableViewController<UITableViewDataSource> ----------> TTModelViewController
| |
dataSource:TTListDataSource model<TTModel>
| ^
model --------------------------------------------------------------------------^
yourDataSource 视图在将要显示时会请求网络获取所需数据,加载中如果缓存中有直接显示,否则通过下载完成回调重新执行表格reload加载数据.
//fecth data from yourModel then put it to sefl.item that property of TTListDataSource, eg TTTableMoreButton item.
- (void)tableViewDidLoadModel:(UITableView*)tableView
YourModel
//请求json
- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more
//将json转化成实体
- (void)requestDidFinishLoad:(TTURLRequest*)request