Three20 是很棒的图书馆。它使使用表格的工作变得非常容易。但我注意到的一个差距 - 是删除行,带有动画。我花了很多时间试图做到这一点,这就是我正在做的事情:
// get current index patch
UITableView* table = [super tableView];
NSIndexPath *indexPath = [table indexPathForSelectedRow];
//delete row in data source
TTListDataSource * source = (TTListDataSource *)self.dataSource;
[source.items removeObjectAtIndex:indexPath.row];
// delete row from the table, with animation
[table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
此代码运行后出现错误:[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)
我正在使用从 TTTableViewController 继承的类。而且我没有实现 DataSourceDelegate 或 TableViewDelegate,因为我尽可能多地使用 Three20。所以,这就是我创建数据源的方式:
for(NSDictionary *album in (NSArray *)albums){
TTTableRightImageItem *item = [TTTableRightImageItem itemWithText:@"name"
imageURL:@"image url"
defaultImage:nil
imageStyle:TTSTYLE(rounded)
URL:@"url of selector where I actually catch the tap on a row"];
[tableItems addObject:item];
}
self.dataSource = [TTListDataSource dataSourceWithItems:tableItems];
我读了这篇文章(文章),但没有帮助:(
所以,我知道这对于这个网站的大师来说非常简单。你能不能给我一些如何做到这一点的高级样本
谢谢