I am using TableviewController. In which i used custom cell having a reply button.When I click on reply button then I want to add view in that same cell. This view is getting added but this cell height is not increasing. how to programatically increase cell height after button click in iOS. I used following code.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row==buttontag1)
{
pppp=[postText objectAtIndex:indexPath.row];
CGSize maxSize = CGSizeMake(280, MAXFLOAT);//set max height
CGSize cellSize = [pppp sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:maxSize lineBreakMode:NSLineBreakByWordWrapping];
//this will return correct height for text
return cellSize.height+150;
}
else
{
pppp=[postText objectAtIndex:indexPath.row];
CGSize maxSize = CGSizeMake(280, MAXFLOAT);//set max height
CGSize cellSize = [pppp sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:maxSize lineBreakMode:NSLineBreakByWordWrapping];
//this will return correct height for text
return cellSize.height+100;
}
}
-(void)reply_comment:(UIButton*)sender
{
buttontag1=sender.tag;
NSLog(@"I Clicked a button button tag %d",buttontag1);
NSString *child=[replyArray objectAtIndex:sender.tag];
if(child== nil || child == (id)[NSNull null]||[child isEqualToString:@"0"])
{
NSLog(@"no child post");
}
else
{
NSLog(@" child post");
ChildViewController *objChildViewController=[[ChildViewController alloc]initWithNibName:@"ChildViewController" bundle:nil];
[cell.child setHidden:NO];
[objChildViewController getchild:posts_id:buttontag1 :uid:frame2];
[cell.child addSubview:objChildViewController.view];
}
}
Please can anyone help me out??