Ios 如何在uitableview中隐藏特定单元格高度的高度

Ios 如何在uitableview中隐藏特定单元格高度的高度,ios,uitableview,Ios,Uitableview,单击按钮时如何在uitableviewcell中隐藏标签 我在tableviewcell中有标签和按钮,当我单击该单元格按钮时,单元格高度应降低,并且单元格标签应隐藏 在此处输入代码 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath { UIWebView *webView=(UIWebView*)[cell.conten

单击按钮时如何在uitableviewcell中隐藏标签

我在tableviewcell中有标签和按钮,当我单击该单元格按钮时,单元格高度应降低,并且单元格标签应隐藏

在此处输入代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath
   {
   UIWebView *webView=(UIWebView*)[cell.contentView viewWithTag:999+indexPath.row];
    if(webView==nil)
    {

     webView =[[UIWebView alloc]initWithFrame:CGRectMake(100, 50, 700, 100)];
    [webView loadHTMLString:[text_Array objectAtIndex:indexPath.row] baseURL:nil];
    webView.backgroundColor=[UIColor clearColor];
    [cell.contentView addSubview:webView];
    webView.tag=indexPath.row+999;

    int hideWeb=[[webHideArr objectAtIndex:indexPath.row]intValue];
    if(hideWeb==1)
    {
        webView.hidden=YES;
    }
    else           
    {
        webView.hidden=NO;
    }
    }
   }

  -(void)reviewedCustomButtonClicked:(id)sender
   {
int irow=[sender tag]-222;

UITableViewCell *Cell=(UITableViewCell*)[progressTableView cellForRowAtIndexPath:    [NSIndexPath indexPathForRow:irow inSection:0]];

UIWebView *web=(UIWebView*)[Cell.contentView viewWithTag:irow+999];
isCustomReviewed=YES;

[webHideArr removeAllObjects];
for(int h=0;h<[array count];h++)
{
    [webHideArr addObject:@"0"];
}

if([btn currentImage]!=[UIImage imageNamed:@"arrow_up.png"])
{
    [btn setImage:[UIImage imageNamed:@"arrow_up.png"] forState:UIControlStateNormal];
    web.hidden=YES;
     [imgArr replaceObjectAtIndex:irow withObject:@"1"];
    [webHideArr replaceObjectAtIndex:irow withObject:@"1"];

}
else
{
    [btn setImage:[UIImage imageNamed:@"arrow_dwn.png"] forState:UIControlStateNormal];
    web.hidden=NO;
    [imgArr replaceObjectAtIndex:irow withObject:@"0"];
    [webHideArr replaceObjectAtIndex:irow withObject:@"1"];
}

increseCellHeight=[sender tag]-222;
decreaseCellHeight=[sender tag]-222;
[progressTableView reloadData];
 }

       - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
   {
    if(isCustomReviewed==YES)
     { 
         if (indexPath.section == 0 && indexPath.row == increseCellHeight)
        {

            return 150;
        }
        else
        {
            return 50;
        }
    }
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
UIWebView*webView=(UIWebView*)[cell.contentView视图带标记:999+indexPath.row];
如果(webView==nil)
{
webView=[[UIWebView alloc]initWithFrame:CGRectMake(100,50700100)];
[webView loadHTMLString:[text_数组objectAtIndex:indexath.row]baseURL:nil];
webView.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:webView];
webView.tag=indexPath.row+999;
int-hideWeb=[[webhiderr-objectAtIndex:indexath.row]intValue];
如果(hideWeb==1)
{
webView.hidden=是;
}
其他的
{
webView.hidden=否;
}
}
}
-(无效)已审核自定义按钮勾选:(id)发件人
{
int irow=[发送者标签]-222;
UITableViewCell*Cell=(UITableViewCell*)[progressTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:irow inSection:0]];
UIWebView*web=(UIWebView*)[Cell.contentView视图带标记:irow+999];
iscustomreview=是;
[WebHiderRemoveAllObjects];

对于(int h=0;h当您单击具有更新高度的按钮并将标签隐藏在中时,需要重新加载表视图([tableView reloadData])

  • (CGFloat)tableView:(UITableView*)表视图行高度索引路径:(NSIndexPath*)索引路径

方法。

tableviewcell中有一个标签和按钮,当我单击“详细信息”单元格按钮时,单元格高度应降低,并且单元格标签应隐藏。请不要使用注释为您自己的问题添加额外信息-只需编辑问题。下面有一个编辑链接。我已经为您完成了此操作。如何编辑选中特定单元格的按钮时隐藏webview