- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; // return list of section titles to display in section index view (e.g. "ABCD...Z#")
可能我没说明白。比如表A里只有一个字段:name,有"c1","a1","a2","b1","d1"这几条数据,section按照a,b,c,d显示,select name from A order by name取出数据后,怎样和section对应起来并显示出来?
没什么难的啊。
2 截取字符串与数据源中sections列表中的a, b, c, d, e比较,若相同,则作如下操作
加入数据源,如:
[ self.datas[0] insertObject:@"aska" atIndex:0]; //section为a的第0行
然后计算这一行的IndexPath
NSArray *indexPaths = @[[NSIndexPath indexPathForRow:0 inSection:0]]; //section为a的第0行
3
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationRight];
[tableView endUpdates];
ps:至于这里面的数据再排序,以及数组的一些逻辑你自己考虑考虑吧。方法就是这样了