I am having an app in which I have a Tableview and on that tableview's each row I am dynamically creating a custom tableview cell.
Below is the code for that.
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"flowviewTableViewCell" owner:self options:nil];
cell2 = [nib objectAtIndex:0];
return cell2;
"FlowTableViewCell" is a UITableViewCell. In this custom cell, I have one tableview.
I am showing some data on my custom tableview cell from an array and those data varies in length. It is not fixed.
I am able to increase the custom cell size but not the main tableview row height depending upon the size of custom tableview cell.
I want to increase the height of the main tableview's cell size dynamically depending upon the size of custom tableview cell.
With the following code, the height of the custom tableView cell is increasing.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *str = [arrComments objectAtIndex:indexPath.row];
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Helvetica" size:14] constrainedToSize:CGSizeMake(280, 999) lineBreakMode:NSLineBreakByWordWrapping];
NSLog(@"%f",size.height);
if (size.height<20)
{
size.height=20;
//m= size.height;
}
NSLog(@"%f",size.height);
return size.height + 30;
}
How can I adjust the height of main tableview's row height depending on the size of custom tableviewcell?
Here,I am attaching some of the screenshots for clear understanding.
The following is my custom TableViewCell:
The following is my main TableView :
Following is the output I am getting right now:
You can see in the above image that comment2 gets cut and comment3 of the same post gets displayed in the next post.
I want output like following Image.
So,my question is how can I increase the height of the main tableview's cell size dynamically depending upon the size of custom tableview cell?
Please help me.any help will be appreciated