ボタンがクリックされたときにuitableviewcellでラベルを非表示にする方法は?
セルの高さを減らし、セルのラベルを非表示にする特定のセルボタンをクリックすると、tableviewcellにラベルとボタンがあります。
enter code here
- (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;
}
}