表示折叠的,=2表示是打开的;
下面最难的就是,折叠打开的方式了;
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableDictionary * dictionary = [NSMutableDictionary dictionaryWithDictionary:[_CellArray objectAtIndex:indexPath.row]];
UITableViewCell *cell = [TableV cellForRowAtIndexPath:indexPath];
NSLog(@"%@",cell.textLabel.text);
if([dictionary objectForKey:@"Group"])
{
NSArray *ChildArray = [dictionary objectForKey:@"Child"];
NSMutableArray *PathArray = [NSMutableArray array];
if(cell.tag==1)
{
cell.tag=2;
for (int i =0 ;i {
dictionary = [ChildArray objectAtIndex:i];
[_CellArray insertObject:dictionary atIndex:i+indexPath.row+1];
NSIndexPath *path = [NSIndexPath indexPathForRow:i+indexPath.row+1 inSection:0];
[PathArray addObject:path];
}
[TableV insertRowsAtIndexPaths:PathArray withRowAnimation:UITableViewRowAnimationAutomatic];
}
else
{
cell.tag=1;
NSMutableIndexSet * deleteSet= [NSMutableIndexSet indexSet];
for (NSDictionary *dic in ChildArray)
{
NSInteger row= [_CellArray indexOfObject:dic];
NSIndexPath * Path = [NSIndexPath indexPathForRow:row inSection:0];
[PathArray addObject:Path];
[deleteSet addIndex:row];
}
[_CellArray removeObjectsAtIndexes:deleteSet];
[TableV deleteRowsAtIndexPaths:PathArray withRowAnimation:UITableViewRowAnimationBottom];
}
}
}
好了,QQ界面的源码在
------------------------------------------分割线------------------------------------------
具体下载目录在 /2014年资料/8月/25日/iOS 实现QQ界面
------------------------------------------分割线------------------------------------------
欢迎下载