Three20 はすばらしいライブラリです。これにより、テーブルの操作が非常に簡単になります。しかし、私が気付いた 1 つのギャップは、行の削除とアニメーションです。これを行うために何時間も費やしましたが、これが私がやっていることです:
// 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 から継承したクラスを使用しています。また、できる限り Three20 を使用しているため、DataSourceDelegate や TableViewDelegate は実装していません。だから、これは私がデータソースを作成する方法です:
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];
この記事 (記事)を読みましたが、役に立ちません :(
ですから、これはこのサイトの達人にとって非常に簡単であることを知っています. これを行う方法の高度なサンプルを教えてください
ありがとう