即类似于通讯录,按照26个字母添加section

解决方案 »

  1.   

    CELL里边添加Table(addsubviw)或者按自己喜欢的方式摆放CELL里边的文字(名字前边加空格就好了)。
    没什么难的啊。
      

  2.   

    - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;  // return list of section titles to display in section index view (e.g. "ABCD...Z#")
      

  3.   

    可能我没说明白。比如表A里只有一个字段:name,有"c1","a1","a2","b1","d1"这几条数据,section按照a,b,c,d显示,select name from A order by name取出数据后,怎样和section对应起来并显示出来?
      

  4.   

    1  从[c1, a1, a2, b1, d1]中读取一个数据
    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:至于这里面的数据再排序,以及数组的一些逻辑你自己考虑考虑吧。方法就是这样了