I have a table view.I has one custom cell in it.In that custom cell i have a UITableView
.This child tableview can have cells & their content height can be dynamic.So i want calculate height of each cell & multiply the no of cells.After that height which is calculated give height to the main cell.
I wil use below logic
**Total height of main cell = height of each cell in child tableview * no of cells + header**
but i don't know how to do it.Please guide me how can i do this
Try this
[tableView reloadData] ;
CGSize tableViewSize= tableView.contentSize; // here you get your tablview's total height
Get parent cell for your tableView
UITableViewCell *parentCellcell =(UITableViewCell *)tableView.superview.superview; // track your cell
if (parentCellcell){
NSIndexPath *indexPath = [tblViewParent indexPathForCell:cell];
[tblViewParent reloadRowsAtIndexPaths:[NSArray
arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.