展开折叠UITableViewCell

Ksh*_*ire 16 iphone cocoa-touch objective-c uitableview

可能重复:
UITableView单元格在单击时展开

我在UITableView的UITableViewCell中需要帮助.我的要求如下:

在此输入图像描述

当我点击转发跟随出现时,查看转推,列表和更多 在此输入图像描述

你可以看到转推扩展并显示其他列表和列表以及下面的更多幻灯片.我想做同样的事情.任何类型的帮助都是高度赞赏,教程链接或任何东西.谢谢

Vin*_*Vin 20

您也可以从Apple 找到这个示例代码,非常有帮助.


Nit*_*hin 8

我已经使用tableview标头实现了类似的一个.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 32)];
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.tag = section;
    sectionButton.frame = customView.frame;
    [sectionButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];

    UILabel *titleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 32)] autorelease];
    titleLabel.textAlignment = UITextAlignmentCenter;
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.font = [UIFont boldSystemFontOfSize:13];
    titleLabel.textColor = [UIColor whiteColor];

    NSString *tableHeader = @"table_header_down.png";
    switch (section) {
        case 0:
            titleLabel.text = @"Section1";
            tableHeader = showSection1 ? @"table_header_up.png" : @"table_header_down.png";
            break;
        case 1:
            titleLabel.text = @"Section2";
            tableHeader = showSection2 ? @"table_header_up.png" : @"table_header_down.png";
            break;
        case 2:
            titleLabel.text = @"Section3";
            tableHeader = showSection3 ? @"table_header_up.png" : @"table_header_down.png";
            break;
        case 3:
            titleLabel.text = @"Section4";
            tableHeader = showSection4 ? @"table_header_up.png" : @"table_header_down.png";
            break;
        default:
            break;
    }
    [sectionButton setImage:[UIImage imageNamed:tableHeader] forState:UIControlStateNormal];
    [customView addSubview:sectionButton];

    [customView addSubview:titleLabel];

    return [customView autorelease];
}
Run Code Online (Sandbox Code Playgroud)

然后我相应地将单元格加载到与每个部分对应的布尔值,如果Bool 0,则行数返回0,并在Bool 1时返回计数.